PSCF v1.1
|
A dynamic array that only holds pointers to its elements. More...
#include <DPArray.h>
Public Member Functions | |
DPArray () | |
Constructor. More... | |
DPArray (DPArray< Data > const &other) | |
Copy constructor, copy pointers. More... | |
virtual | ~DPArray () |
Destructor. More... | |
DPArray< Data > & | operator= (DPArray< Data > const &other) |
Assignment, element by element. More... | |
void | allocate (int capacity) |
Allocate an array of pointers to Data. More... | |
void | append (Data &data) |
Append an element to the end of the sequence. More... | |
void | clear () |
Reset to empty state. More... | |
bool | isAllocated () const |
Is this DPArray allocated? More... | |
![]() | |
virtual | ~PArray () |
Destructor. More... | |
int | capacity () const |
Return allocated size. More... | |
int | size () const |
Return logical size. More... | |
void | begin (PArrayIterator< Data > &iterator) const |
Set a PArrayIterator to the beginning of this PArray. More... | |
void | begin (ConstPArrayIterator< Data > &iterator) const |
Set a ConstPArrayIterator to the beginning of this PArray. More... | |
Data & | operator[] (int i) const |
Mimic C array subscripting. More... | |
Additional Inherited Members | |
![]() | |
PArray () | |
Constructor (protected to prevent instantiation). More... | |
![]() | |
Data ** | ptrs_ |
PArray of of pointers to Data objects. More... | |
int | capacity_ |
Allocated size of ptrs_ array. More... | |
int | size_ |
Logical size (number of elements with initialized data). More... | |
A dynamic array that only holds pointers to its elements.
|
inline |
Util::DPArray< Data >::DPArray | ( | DPArray< Data > const & | other | ) |
Copy constructor, copy pointers.
Allocates new Data* array and copies pointers to Data objects.
other | the DPArray to be copied. |
Definition at line 111 of file DPArray.h.
References Util::PArray< Data >::capacity_, Util::DPArray< Data >::isAllocated(), Util::PArray< Data >::ptrs_, Util::PArray< Data >::size_, and UTIL_THROW.
|
virtual |
DPArray< Data > & Util::DPArray< Data >::operator= | ( | DPArray< Data > const & | other | ) |
Assignment, element by element.
Preconditions:
other | the rhs DPArray |
Definition at line 139 of file DPArray.h.
References Util::PArray< Data >::ptrs_, Util::PArray< Data >::size_, and UTIL_THROW.
void Util::DPArray< Data >::allocate | ( | int | capacity | ) |
|
inline |
Append an element to the end of the sequence.
data | Data object to be appended |
Definition at line 208 of file DPArray.h.
References UTIL_THROW.
void Util::DPArray< Data >::clear |
|
inline |
Is this DPArray allocated?
Definition at line 235 of file DPArray.h.
Referenced by Util::DPArray< Data >::DPArray().