#include <TpArray.h>
Public Types | |
typedef const Tp * | const_iterator |
for const iterator returns | |
typedef const value_type | const_pointer |
a read-only pointer possibly to an object of the value_type | |
typedef const value_type & | const_reference |
a read-only reference to an object of the value_type | |
typedef Tp * | iterator |
as in STL an iterator is just about the same as a pointer. | |
typedef value_type * | pointer |
a read-write pointer possibly to an object of the value_type | |
typedef value_type & | reference |
a reference to an object of the value_type | |
typedef unsigned int | size_type |
for size values | |
typedef TpArray< Tp > | tparray |
the type of this container array, thus our own type | |
typedef Tp | value_type |
the value we are talking about here | |
Public Member Functions | |
const_iterator | begin () const |
return a read-only constant pointer to the first element | |
iterator | begin () |
return a read/write pointer to the first element | |
size_type | capacity () const |
return the capacity (available elements before more need to be allocated) | |
void | clear () |
clear destroys all objects in the array and resets it's size | |
bool | empty () const |
returns true if the array is empty | |
const_iterator | end () const |
return a read-only constant pointer just past the last valid element | |
iterator | end () |
return a read/write pointer just past the last valid element | |
const_reference | last () const |
return a reference to the last valid object in the array | |
reference | last () |
return a reference to the last valid object in the array | |
reference | new_back () |
this function constructs a default object at the end of the array, growing it if necessary and returns a reference to the new object. | |
tparray & | operator= (const tparray &other) |
assignment operator: destroys all contained objects and creates copies of those in the other array | |
const_reference | operator[] (size_type n) const |
easy and fast read-only subscription access | |
reference | operator[] (size_type n) |
easy and fast subscription access to an element of the array | |
void | push_back (const_reference obj) |
this function copy-constructs a new object at the end of the array from the given object reference. | |
void | reserve (size_type n) |
make sure at least n elements are avaiable before more need to be allocated. | |
void | set_size (size_type n) |
manually sets the array size after direct loading | |
size_type | size () const |
return currently used number of elements in the array | |
void | swap (tparray &other) |
swaps this array's contents with the other array object | |
TpArray (const tparray &other) | |
copy constructor: allocates a new array and copies each element | |
TpArray (size_type _reserve) | |
allocate an array and possibly reverse available space | |
TpArray () | |
initialize an empty array | |
~TpArray () | |
calls the destructor for all contained elements and frees the array |
Most importantly: it does not grow quadratic (this gets annoying in the range of 512MB vector sizes). The code is based on Sgi's std::vector's.
Definition at line 16 of file TpArray.h.
typedef const Tp* VGServer::TpArray< Tp >::const_iterator |
typedef const value_type VGServer::TpArray< Tp >::const_pointer |
typedef const value_type& VGServer::TpArray< Tp >::const_reference |
typedef Tp* VGServer::TpArray< Tp >::iterator |
typedef value_type* VGServer::TpArray< Tp >::pointer |
typedef value_type& VGServer::TpArray< Tp >::reference |
typedef unsigned int VGServer::TpArray< Tp >::size_type |
typedef TpArray<Tp> VGServer::TpArray< Tp >::tparray |
typedef Tp VGServer::TpArray< Tp >::value_type |
VGServer::TpArray< Tp >::TpArray | ( | ) | [inline] |
VGServer::TpArray< Tp >::TpArray | ( | size_type | _reserve | ) | [inline, explicit] |
VGServer::TpArray< Tp >::TpArray | ( | const tparray & | other | ) | [inline] |
VGServer::TpArray< Tp >::~TpArray | ( | ) | [inline] |
const_iterator VGServer::TpArray< Tp >::begin | ( | ) | const [inline] |
iterator VGServer::TpArray< Tp >::begin | ( | ) | [inline] |
return a read/write pointer to the first element
Definition at line 157 of file TpArray.h.
Referenced by VGServer::TpArray< VGServer::GraphData::Vertex >::clear(), VGServer::TpArray< VGServer::GraphData::Vertex >::empty(), VGServer::TpArray< VGServer::GraphData::Vertex >::operator=(), VGServer::TpArray< VGServer::GraphData::Vertex >::operator[](), and VGServer::TpArray< VGServer::GraphData::Vertex >::TpArray().
size_type VGServer::TpArray< Tp >::capacity | ( | ) | const [inline] |
return the capacity (available elements before more need to be allocated)
Definition at line 118 of file TpArray.h.
Referenced by VGServer::TpArray< VGServer::GraphData::Vertex >::new_back(), VGServer::TpArray< VGServer::GraphData::Vertex >::push_back(), VGServer::TpArray< VGServer::GraphData::Vertex >::reserve(), and VGServer::TpArray< VGServer::GraphData::Vertex >::set_size().
void VGServer::TpArray< Tp >::clear | ( | ) | [inline] |
clear destroys all objects in the array and resets it's size
Definition at line 173 of file TpArray.h.
Referenced by VGServer::TpArray< VGServer::GraphData::Vertex >::operator=(), and VGServer::TpArray< VGServer::GraphData::Vertex >::~TpArray().
bool VGServer::TpArray< Tp >::empty | ( | ) | const [inline] |
const_iterator VGServer::TpArray< Tp >::end | ( | ) | const [inline] |
iterator VGServer::TpArray< Tp >::end | ( | ) | [inline] |
return a read/write pointer just past the last valid element
Definition at line 165 of file TpArray.h.
Referenced by VGServer::TpArray< VGServer::GraphData::Vertex >::clear(), VGServer::TpArray< VGServer::GraphData::Vertex >::empty(), VGServer::TpArray< VGServer::GraphData::Vertex >::last(), VGServer::TpArray< VGServer::GraphData::Vertex >::operator=(), and VGServer::TpArray< VGServer::GraphData::Vertex >::TpArray().
const_reference VGServer::TpArray< Tp >::last | ( | ) | const [inline] |
reference VGServer::TpArray< Tp >::last | ( | ) | [inline] |
reference VGServer::TpArray< Tp >::new_back | ( | ) | [inline] |
this function constructs a default object at the end of the array, growing it if necessary and returns a reference to the new object.
This is the main function to be used when building the data. Thus no temporary objects are created as with STL's push_back(reference).
Definition at line 201 of file TpArray.h.
Referenced by VGServer::GraphData::applyChangelist().
tparray& VGServer::TpArray< Tp >::operator= | ( | const tparray & | other | ) | [inline] |
const_reference VGServer::TpArray< Tp >::operator[] | ( | size_type | n | ) | const [inline] |
reference VGServer::TpArray< Tp >::operator[] | ( | size_type | n | ) | [inline] |
void VGServer::TpArray< Tp >::push_back | ( | const_reference | obj | ) | [inline] |
void VGServer::TpArray< Tp >::reserve | ( | size_type | n | ) | [inline] |
make sure at least n elements are avaiable before more need to be allocated.
Definition at line 131 of file TpArray.h.
Referenced by VGServer::GraphData::applyChangelist(), VGServer::TpArray< VGServer::GraphData::Vertex >::new_back(), VGServer::TpArray< VGServer::GraphData::Vertex >::operator=(), VGServer::TpArray< VGServer::GraphData::Vertex >::push_back(), and VGServer::TpArray< VGServer::GraphData::Vertex >::TpArray().
void VGServer::TpArray< Tp >::set_size | ( | size_type | n | ) | [inline] |
manually sets the array size after direct loading
Definition at line 153 of file TpArray.h.
Referenced by VGServer::TpArray< VGServer::GraphData::Vertex >::operator=(), and VGServer::TpArray< VGServer::GraphData::Vertex >::TpArray().
size_type VGServer::TpArray< Tp >::size | ( | ) | const [inline] |
return currently used number of elements in the array
Definition at line 122 of file TpArray.h.
Referenced by VGServer::GraphData::applyChangelist(), VGServer::TpArray< VGServer::GraphData::Vertex >::last(), VGServer::TpArray< VGServer::GraphData::Vertex >::new_back(), VGServer::TpArray< VGServer::GraphData::Vertex >::operator=(), VGServer::TpArray< VGServer::GraphData::Vertex >::operator[](), VGServer::TpArray< VGServer::GraphData::Vertex >::push_back(), VGServer::TpArray< VGServer::GraphData::Vertex >::reserve(), and VGServer::TpArray< VGServer::GraphData::Vertex >::TpArray().
void VGServer::TpArray< Tp >::swap | ( | tparray & | other | ) | [inline] |