Public Types | |
typedef T | value_type |
the type of elements that this OFVector stores | |
typedef size_t | size_type |
the type used for sizes and indexes | |
typedef T * | iterator |
the type of mutable iterators on this object | |
typedef const T * | const_iterator |
the type of constant iterators on this object | |
Public Member Functions | |
OFVector () | |
default constructor. | |
OFVector (const OFVector &other) | |
copy constructor. | |
OFVector (size_type n, const T &v=T()) | |
construct an OFVector with predefined content. | |
OFVector (const_iterator from, const_iterator to) | |
construct an OFVector from a range of iterators. | |
~OFVector () | |
destructor. | |
OFVector & | operator= (const OFVector &other) |
assignment operator. | |
void | swap (OFVector &other) |
swap this vector's content with some other vector. | |
iterator | begin () |
get an iterator for the first element in this object. | |
const_iterator | begin () const |
get an iterator for the first element in this object. | |
iterator | end () |
get an iterator that points past the last valid object. | |
const_iterator | end () const |
get an iterator that points past the last valid object. | |
size_type | size () const |
get the size of this OFVector. | |
OFBool | empty () const |
check wether this OFVector is empty. | |
void | clear () |
clear this OFVector. | |
void | erase (iterator it) |
removes an entry from this OFVector. | |
iterator | insert (iterator it, const T &v) |
insert an entry in this OFVector. | |
template<class InputIterator> | |
void | insert (iterator it, InputIterator from, InputIterator to) |
insert a range of elements in this OFVector. | |
void | push_back (const T &v) |
insert an entry at the end of this object | |
void | pop_back () |
remove the last entry in this object | |
T & | operator[] (size_type i) |
access an entry by index. | |
const T & | operator[] (size_type i) const |
access an entry by index. | |
T & | at (size_type i) |
access an entry by index. | |
const T & | at (size_type i) const |
access an entry by index. | |
void | resize (size_type n, T v=T()) |
resize this OFVector. | |
void | reserve (size_type n) |
reserves enough space for the given number of elements. | |
Protected Attributes | |
T * | values_ |
array that is used for storing the entries in this OFVector | |
size_type | allocated_ |
the size for which values_ was allocated | |
size_type | size_ |
the number of valid entries in values_. |
You can add and remove elements after it was created and this class will handle all the memory management needed. This implements parts of std::vector's features.
Definition at line 61 of file ofvector.h.
copy constructor.
other | OFVector from which all elements are copied |
Definition at line 97 of file ofvector.h.
construct an OFVector with predefined content.
n | number of elements that this OFVector should have. | |
v | The value used for all elements. |
Definition at line 108 of file ofvector.h.
OFVector< T >::OFVector | ( | const_iterator | from, | |
const_iterator | to | |||
) | [inline] |
construct an OFVector from a range of iterators.
from | first iterator to include | |
to | first iterator that should not be included anymore |
Definition at line 121 of file ofvector.h.
assignment operator.
All elements from this object are removed and then a copy of other is made. All iterators to this object will become invalid.
other | OFVector instance to copy elements from. |
Definition at line 140 of file ofvector.h.
swap this vector's content with some other vector.
All iterators will stay valid.
other | object to swap with |
Definition at line 153 of file ofvector.h.
get an iterator for the first element in this object.
Definition at line 171 of file ofvector.h.
Referenced by OFVector< TRANSFORM::SAMPLE >::erase(), OFVector< TRANSFORM::SAMPLE >::insert(), OFVector< TRANSFORM::SAMPLE >::OFVector(), and OFVector< TRANSFORM::SAMPLE >::operator=().
const_iterator OFVector< T >::begin | ( | ) | const [inline] |
get an iterator for the first element in this object.
Definition at line 176 of file ofvector.h.
get an iterator that points past the last valid object.
Definition at line 181 of file ofvector.h.
Referenced by OFVector< TRANSFORM::SAMPLE >::OFVector(), OFVector< TRANSFORM::SAMPLE >::operator=(), OFVector< TRANSFORM::SAMPLE >::pop_back(), and OFVector< TRANSFORM::SAMPLE >::push_back().
const_iterator OFVector< T >::end | ( | ) | const [inline] |
get an iterator that points past the last valid object.
Definition at line 186 of file ofvector.h.
get the size of this OFVector.
Definition at line 191 of file ofvector.h.
Referenced by JlsCodec< TRAITS, STRATEGY >::InitQuantizationLUT(), OFVector< TRANSFORM::SAMPLE >::OFVector(), OFVector< TRANSFORM::SAMPLE >::operator=(), and JLSOutputStream::WriteBytes().
OFBool OFVector< T >::empty | ( | void | ) | const [inline] |
check wether this OFVector is empty.
Definition at line 196 of file ofvector.h.
void OFVector< T >::clear | ( | ) | [inline] |
clear this OFVector.
The existing content will be freed and all iterators become invalid.
Definition at line 201 of file ofvector.h.
Referenced by OFVector< TRANSFORM::SAMPLE >::operator=().
removes an entry from this OFVector.
All iterators pointing to the element removed or elements that come behind it in this OFVector will become invalid.
it | iterator for the entry that should be removed. |
Definition at line 216 of file ofvector.h.
Referenced by OFVector< TRANSFORM::SAMPLE >::pop_back().
insert an entry in this OFVector.
All iterators for this OFVector become invalid.
it | the new element will be inserted in front of the element to which this iterator points. | |
v | the element to insert |
Definition at line 232 of file ofvector.h.
Referenced by OFVector< TRANSFORM::SAMPLE >::insert(), and OFVector< TRANSFORM::SAMPLE >::push_back().
void OFVector< T >::insert | ( | iterator | it, | |
InputIterator | from, | |||
InputIterator | to | |||
) | [inline] |
insert a range of elements in this OFVector.
All iterators for this OFVector become invalid.
it | the new elements will be inserted in front of the element to which this iterator points. | |
from | iterator to the beginning of the range to insert. | |
to | iterator past the end of the range to insert. |
Definition at line 253 of file ofvector.h.
void OFVector< T >::push_back | ( | const T & | v | ) | [inline] |
insert an entry at the end of this object
v | the value to insert |
Definition at line 266 of file ofvector.h.
Referenced by JlsContext::CreateTableC(), OFVector< TRANSFORM::SAMPLE >::OFVector(), and OFVector< TRANSFORM::SAMPLE >::operator=().
access an entry by index.
undefined behavior occurs when the index is out of bounds (bigger than the maximum allowed index).
i | index of the element to return |
Definition at line 283 of file ofvector.h.
access an entry by index.
undefined behavior occurs when the index is out of bounds (bigger than the maximum allowed index).
i | index of the element to return |
Definition at line 293 of file ofvector.h.
access an entry by index.
i | index of the element to return |
Definition at line 302 of file ofvector.h.
access an entry by index.
i | index of the element to return |
Definition at line 312 of file ofvector.h.
resize this OFVector.
after this call, size() will be n.
n | the new size that this object should use | |
v | if any new elements need to be inserted, they get this value. |
Definition at line 322 of file ofvector.h.
Referenced by JlsCodec< TRAITS, STRATEGY >::InitQuantizationLUT(), and OFVector< TRANSFORM::SAMPLE >::OFVector().
reserves enough space for the given number of elements.
from now on, no memory allocations will occur as long as this OFVector's size stays below n and clear() is not called.
n | the number of elements for which space should be reserved. |
Definition at line 339 of file ofvector.h.
Referenced by OFVector< TRANSFORM::SAMPLE >::clear(), JlsContext::CreateTableC(), OFVector< TRANSFORM::SAMPLE >::insert(), OFVector< TRANSFORM::SAMPLE >::OFVector(), OFVector< TRANSFORM::SAMPLE >::operator=(), and OFVector< TRANSFORM::SAMPLE >::resize().
the number of valid entries in values_.
elements past this index have undefined content.
Definition at line 84 of file ofvector.h.
Referenced by OFVector< TRANSFORM::SAMPLE >::at(), OFVector< TRANSFORM::SAMPLE >::clear(), OFVector< TRANSFORM::SAMPLE >::empty(), OFVector< TRANSFORM::SAMPLE >::end(), OFVector< TRANSFORM::SAMPLE >::erase(), OFVector< TRANSFORM::SAMPLE >::insert(), OFVector< TRANSFORM::SAMPLE >::reserve(), OFVector< TRANSFORM::SAMPLE >::resize(), OFVector< TRANSFORM::SAMPLE >::size(), and OFVector< TRANSFORM::SAMPLE >::swap().