#include <DistribRefVector.h>


Public Member Functions | |
| DistribRefVector (unsigned long capacity=1) | |
| DistribRefVector (const DistribRefVector &) | |
| virtual | ~DistribRefVector () |
| unsigned long | addDistrib (Distrib &distrib) |
| void | setDistrib (Distrib &d, unsigned long index) const |
| Distrib & | getDistrib (unsigned long index) const |
| Distrib ** | getArray () const |
| void | deleteUnreferencedDistribs () |
| void | deleteUnreferencedDistrib (const Distrib &d) |
| unsigned long | size () const |
| void | clear () |
| virtual String | getClassName () const |
Private Member Functions | |
| Distrib ** | createArray () const |
| const DistribRefVector & | operator= (const DistribRefVector &) |
| bool | operator== (const DistribRefVector &) const |
| bool | operator!= (const DistribRefVector &) const |
Private Attributes | |
| unsigned long | _size |
| unsigned long | _capacity |
| Distrib ** | _array |
Friends | |
| class | TestDistribRefVector |
This class implements a growable array of Distrib objects. Note that the array just store pointers on Distrib objects. If you delete the array, the Distrib objects are not deleted.
Definition at line 81 of file DistribRefVector.h.
| DistribRefVector::DistribRefVector | ( | unsigned long | capacity = 1 ) |
[explicit] |
Create a DistribRefVector object.
| capacity | maximum number of elements in the array The capacity will grow automatically when the size will overtake the capacity |
Definition at line 69 of file DistribRefVector.cpp.
| DistribRefVector::DistribRefVector | ( | const DistribRefVector & | v ) |
Definition at line 73 of file DistribRefVector.cpp.
References _array, _size, and alize::K::k.
| DistribRefVector::~DistribRefVector | ( | ) | [virtual] |
Definition at line 179 of file DistribRefVector.cpp.
| unsigned long DistribRefVector::addDistrib | ( | Distrib & | distrib ) |
Appends a Distrib object to the end of the vector
| distrib | the object to add |
Definition at line 107 of file DistribRefVector.cpp.
References _array, _capacity, _size, createArray(), alize::K::k, NULL, and alize::Distrib::refCounter().
| void DistribRefVector::clear | ( | ) |
Definition at line 165 of file DistribRefVector.cpp.
References _array, _size, alize::K::k, NULL, and alize::Distrib::refCounter().
Referenced by ~DistribRefVector().
| Distrib ** DistribRefVector::createArray | ( | ) | const [private] |
Definition at line 81 of file DistribRefVector.cpp.
References _capacity, and alize::Object::assertMemoryIsAllocated().
Referenced by addDistrib().
| void DistribRefVector::deleteUnreferencedDistrib | ( | const Distrib & | d ) |
Deletes a distribution if it is not referenced by other objects
Definition at line 142 of file DistribRefVector.cpp.
References _array, _size, alize::K::k, and NULL.
| void DistribRefVector::deleteUnreferencedDistribs | ( | ) |
Deletes all distributions which are not referenced by other objects
Definition at line 123 of file DistribRefVector.cpp.
References _array, _size, alize::K::k, NULL, and alize::Distrib::refCounter().
| Distrib ** DistribRefVector::getArray | ( | ) | const |
Use this method to access directly to the internal vector
Definition at line 161 of file DistribRefVector.cpp.
References _array.
| String DistribRefVector::getClassName | ( | ) | const [virtual] |
Returns the name of the class
Implements alize::Object.
Definition at line 177 of file DistribRefVector.cpp.
| Distrib & DistribRefVector::getDistrib | ( | unsigned long | index ) | const |
Returns the Distrib object at the specified index
| index | an index into this vector |
| IndexOutOfBoundsException |
Definition at line 89 of file DistribRefVector.cpp.
References _array, _size, alize::Object::assertIsInBounds(), and NULL.
| bool alize::DistribRefVector::operator!= | ( | const DistribRefVector & | ) | const [private] |
Not implemented
| const DistribRefVector& alize::DistribRefVector::operator= | ( | const DistribRefVector & | ) | [private] |
| bool alize::DistribRefVector::operator== | ( | const DistribRefVector & | ) | const [private] |
Not implemented
| void DistribRefVector::setDistrib | ( | Distrib & | d, |
| unsigned long | index | ||
| ) | const |
Set a Distrib object at a specified location in the vector. Note that the previous object inside this location is not destroyed.
| d | the object to store |
| index | an index into this vector |
| IndexOutOfBoundsException |
Definition at line 96 of file DistribRefVector.cpp.
References _array, _size, alize::Object::assertIsInBounds(), alize::K::k, NULL, and alize::Distrib::refCounter().
| unsigned long DistribRefVector::size | ( | ) | const |
Definition at line 163 of file DistribRefVector.cpp.
References _size.
friend class TestDistribRefVector [friend] |
Definition at line 83 of file DistribRefVector.h.
Distrib** alize::DistribRefVector::_array [private] |
Definition at line 146 of file DistribRefVector.h.
Referenced by addDistrib(), clear(), deleteUnreferencedDistrib(), deleteUnreferencedDistribs(), DistribRefVector(), getArray(), getDistrib(), setDistrib(), and ~DistribRefVector().
unsigned long alize::DistribRefVector::_capacity [private] |
Definition at line 145 of file DistribRefVector.h.
Referenced by addDistrib(), and createArray().
unsigned long alize::DistribRefVector::_size [private] |
Definition at line 144 of file DistribRefVector.h.
Referenced by addDistrib(), clear(), deleteUnreferencedDistrib(), deleteUnreferencedDistribs(), DistribRefVector(), getDistrib(), setDistrib(), and size().
1.7.2