#include <fixed_array.hh>
Public Member Functions | |
FixedArray (std::size_t limit) | |
FixedArray () | |
void | Init (std::size_t count) |
FixedArray (const FixedArray &from) | |
~FixedArray () | |
T * | begin () |
const T * | begin () const |
T * | end () |
const T * | end () const |
T & | back () |
const T & | back () const |
std::size_t | size () const |
bool | empty () const |
T & | operator[] (std::size_t i) |
const T & | operator[] (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 () |
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.
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.
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.
Definition at line 33 of file fixed_array.hh.
util::FixedArray< T >::FixedArray | ( | const FixedArray< T > & | from | ) | [inline] |
Constructs a copy of the provided array.
from | Array whose elements should be copied into this newly-constructed data structure. |
Definition at line 61 of file fixed_array.hh.
util::FixedArray< T >::~FixedArray | ( | ) | [inline] |
Frees the memory held by this object.
Definition at line 72 of file fixed_array.hh.
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.
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().
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.
T* util::FixedArray< T >::begin | ( | ) | [inline] |
Gets a pointer to the first object currently stored in this data structure.
Definition at line 75 of file fixed_array.hh.
Referenced by util::FixedArray< Sort< Compare, Combine > >::clear(), util::FixedArray< Sort< Compare, Combine > >::empty(), util::stream::GenericStreams< NGramStream< Payload > >::Init(), util::stream::ChainPositions::Init(), util::FixedArray< Sort< Compare, Combine > >::Init(), util::FixedArray< Sort< Compare, Combine > >::operator[](), and util::FixedArray< Sort< Compare, Combine > >::size().
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().
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().
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.
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.
T* util::FixedArray< T >::end | ( | ) | [inline] |
Gets a pointer to the last object currently stored in this data structure.
Definition at line 81 of file fixed_array.hh.
Referenced by util::FixedArray< Sort< Compare, Combine > >::back(), util::FixedArray< Sort< Compare, Combine > >::empty(), util::stream::ChainPositions::Init(), util::stream::Sorts< Compare, Combine >::push_back(), util::FixedArray< Sort< Compare, Combine > >::push_back(), and util::FixedArray< Sort< Compare, Combine > >::size().
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().
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.
i | Index of the object to reference |
Definition at line 113 of file fixed_array.hh.
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.
i | Index of the object to reference |
Definition at line 103 of file fixed_array.hh.
void util::FixedArray< T >::pop_back | ( | ) | [inline] |
Definition at line 142 of file fixed_array.hh.
Referenced by util::FixedArray< Sort< Compare, Combine > >::clear().
void util::FixedArray< T >::push_back | ( | const C & | c, | |
const D & | d | |||
) | [inline] |
Definition at line 137 of file fixed_array.hh.
Definition at line 133 of file fixed_array.hh.
Definition at line 129 of file fixed_array.hh.
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().
std::size_t util::FixedArray< T >::size | ( | ) | const [inline] |
Gets the number of objects currently stored in this data structure.
Definition at line 93 of file fixed_array.hh.
Referenced by lm::builder::Print< V >::DumpSeparateFiles(), util::FixedArray< Sort< Compare, Combine > >::FixedArray(), util::stream::GenericStreams< NGramStream< Payload > >::Init(), util::stream::ChainPositions::Init(), lm::builder::InitialProbabilities(), lm::JointOrder(), util::FixedArray< Sort< Compare, Combine > >::operator[](), lm::PrintARPA::Run(), lm::builder::Interpolate::Run(), lm::builder::AdjustCounts::Run(), lm::ModelBuffer::Sink(), and lm::ModelBuffer::Source().