util::FixedArray< T > Class Template Reference

#include <fixed_array.hh>

Inheritance diagram for util::FixedArray< T >:

Inheritance graph
[legend]
Collaboration diagram for util::FixedArray< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 FixedArray (std::size_t limit)
 FixedArray ()
void Init (std::size_t count)
 FixedArray (const FixedArray &from)
 ~FixedArray ()
Tbegin ()
const Tbegin () const
Tend ()
const Tend () const
Tback ()
const Tback () const
std::size_t size () const
bool empty () const
Toperator[] (std::size_t i)
const Toperator[] (std::size_t i) const
void push_back ()
template<class C >
void push_back (const C &c)
template<class C >
void push_back (C &c)
template<class C , class D >
void push_back (const C &c, const D &d)
void pop_back ()
void clear ()

Protected Member Functions

void Constructed ()


Detailed Description

template<class T>
class util::FixedArray< T >

Defines an array with fixed maximum size.

Ever want an array of things but they don't have a default constructor or are non-copyable? FixedArray allows constructing one at a time.

Definition at line 19 of file fixed_array.hh.


Constructor & Destructor Documentation

template<class T>
util::FixedArray< T >::FixedArray ( std::size_t  limit  )  [inline, explicit]

Initialize with a given size bound but do not construct the objects.

Definition at line 22 of file fixed_array.hh.

template<class T>
util::FixedArray< T >::FixedArray (  )  [inline]

Constructs an instance, but does not initialize it.

Any objects constructed in this manner must be subsequently initialized prior to use.

See also:
FixedArray::Init()

Definition at line 33 of file fixed_array.hh.

template<class T>
util::FixedArray< T >::FixedArray ( const FixedArray< T > &  from  )  [inline]

Constructs a copy of the provided array.

Parameters:
from Array whose elements should be copied into this newly-constructed data structure.

Definition at line 61 of file fixed_array.hh.

template<class T>
util::FixedArray< T >::~FixedArray (  )  [inline]

Frees the memory held by this object.

Definition at line 72 of file fixed_array.hh.


Member Function Documentation

template<class T>
const T& util::FixedArray< T >::back (  )  const [inline]

Gets a const reference to the last object currently stored in this data structure.

Definition at line 90 of file fixed_array.hh.

template<class T>
T& util::FixedArray< T >::back (  )  [inline]

Gets a reference to the last object currently stored in this data structure.

Definition at line 87 of file fixed_array.hh.

Referenced by util::FixedArray< Sort< Compare, Combine > >::pop_back(), lm::PrintARPA::Run(), and lm::ModelBuffer::Sink().

Here is the caller graph for this function:

template<class T>
const T* util::FixedArray< T >::begin (  )  const [inline]

Gets a const pointer to the last object currently stored in this data structure.

Definition at line 78 of file fixed_array.hh.

template<class T>
T* util::FixedArray< T >::begin (  )  [inline]

template<class T>
void util::FixedArray< T >::clear (  )  [inline]

Removes all elements from this array.

Definition at line 150 of file fixed_array.hh.

Referenced by util::FixedArray< Sort< Compare, Combine > >::~FixedArray().

Here is the caller graph for this function:

template<class T>
void util::FixedArray< T >::Constructed (  )  [inline, protected]

Definition at line 157 of file fixed_array.hh.

Referenced by util::stream::Sorts< Compare, Combine >::push_back(), and util::FixedArray< Sort< Compare, Combine > >::push_back().

Here is the caller graph for this function:

template<class T>
bool util::FixedArray< T >::empty (  )  const [inline]

Returns true if there are no objects currently stored in this data structure.

Definition at line 96 of file fixed_array.hh.

template<class T>
const T* util::FixedArray< T >::end (  )  const [inline]

Gets a const pointer to the last object currently stored in this data structure.

Definition at line 84 of file fixed_array.hh.

template<class T>
T* util::FixedArray< T >::end (  )  [inline]

template<class T>
void util::FixedArray< T >::Init ( std::size_t  count  )  [inline]

Initialize with a given size bound but do not construct the objects.

This method is responsible for allocating memory. Objects stored in this array will be constructed in a location within this allocated memory.

Reimplemented in util::stream::GenericStreams< T >, and util::stream::GenericStreams< NGramStream< Payload > >.

Definition at line 46 of file fixed_array.hh.

Referenced by util::FixedArray< Sort< Compare, Combine > >::FixedArray(), lm::ModelBuffer::ModelBuffer(), and lm::ModelBuffer::Sink().

Here is the caller graph for this function:

template<class T>
const T& util::FixedArray< T >::operator[] ( std::size_t  i  )  const [inline]

Gets a const reference to the object with index i currently stored in this data structure.

Parameters:
i Index of the object to reference

Definition at line 113 of file fixed_array.hh.

template<class T>
T& util::FixedArray< T >::operator[] ( std::size_t  i  )  [inline]

Gets a reference to the object with index i currently stored in this data structure.

Parameters:
i Index of the object to reference

Definition at line 103 of file fixed_array.hh.

template<class T>
void util::FixedArray< T >::pop_back (  )  [inline]

Definition at line 142 of file fixed_array.hh.

Referenced by util::FixedArray< Sort< Compare, Combine > >::clear().

Here is the caller graph for this function:

template<class T>
template<class C , class D >
void util::FixedArray< T >::push_back ( const C &  c,
const D &  d 
) [inline]

Definition at line 137 of file fixed_array.hh.

template<class T>
template<class C >
void util::FixedArray< T >::push_back ( C &  c  )  [inline]

Definition at line 133 of file fixed_array.hh.

template<class T>
template<class C >
void util::FixedArray< T >::push_back ( const C &  c  )  [inline]

Definition at line 129 of file fixed_array.hh.

template<class T>
void util::FixedArray< T >::push_back (  )  [inline]

Constructs a new object using the provided parameter, and stores it in this data structure.

The memory backing the constructed object is managed by this data structure. I miss C++11 variadic templates.

Definition at line 125 of file fixed_array.hh.

Referenced by util::FixedArray< Sort< Compare, Combine > >::FixedArray(), lm::builder::InitialProbabilities(), lm::JointOrder(), lm::ModelBuffer::ModelBuffer(), and lm::ModelBuffer::Sink().

Here is the caller graph for this function:

template<class T>
std::size_t util::FixedArray< T >::size (  )  const [inline]


The documentation for this class was generated from the following file:

Generated on Thu Jul 6 00:34:50 2017 for Moses by  doxygen 1.5.9