|
MeVisLab Toolbox Reference
|
Dynamic templated vector. More...
#include <CSOObjectVector.h>
Public Member Functions | |
| CSOObjectVector (unsigned int init=0, unsigned int bs=65535) | |
| Standard constructor. | |
| virtual | ~CSOObjectVector () |
| Standard destructor. | |
| unsigned int | num () const |
| Returns the number of elements in the vector. | |
| T * | atBoundsCheck (unsigned int pos) const |
| Returns the element at the specified position, and returns nullptr when out of range. | |
| T * | at (unsigned int pos) const |
| Returns the element at the specified position. | |
| T * | firstBoundsCheck () const |
| Returns the first element, and return nullptr if out of range. | |
| T * | first () const |
| Returns the first element. | |
| T * | lastBoundsCheck () const |
| Returns the last element, and returns nullptr if out of range. | |
| T * | last () const |
| Returns the last element. | |
| virtual unsigned int | append (T *elem) |
| Appends the element to the back of the vector and returns its position. | |
| virtual void | swap (unsigned int p1, unsigned int p2) |
| Swaps two elements in the vector. | |
| virtual void | clear () |
| Clears all internal pointers. | |
| virtual void | deleteAt (unsigned int pos) |
| Deletes an element at the specified position. | |
| virtual void | deleteLast () |
| Deletes the last element of the vector. | |
| virtual int | remove (T *elem) |
| Deletes an element specified by its pointer and returns its position. | |
| virtual int | lookup (T *elem) const |
| Searches for an element in the vector and returns its position. | |
| virtual int | removeUnSwapped (T *elem) |
| Deletes an element specified by its pointer and returns its position. | |
| virtual void | destroy () |
| Deletes all elements in the vector. | |
| virtual void | replace (T *elem, unsigned int pos) |
| Replaces the element at the specified position with the specified element. | |
| void | reserve (unsigned int init) |
| Reserves a number of elements. It copies old elements if needed. | |
Protected Member Functions | |
| virtual void | expand () |
| Grows vector by adding an extra block of size BLOCKSIZE. | |
| virtual unsigned int | appendUnsafe (T *elem) |
| Appends the element to back of vector. | |
Dynamic templated vector.
For speed and better memory handling, the vector is an array within an array. The base blocks have a BLOCKSIZE of 65535. This allows for quick expanding.
Definition at line 31 of file CSOObjectVector.h.
| ml::CSOObjectVector< T >::CSOObjectVector | ( | unsigned int | init = 0, |
| unsigned int | bs = 65535 |
||
| ) |
|
virtual |
Standard destructor.
Definition at line 136 of file CSOObjectVector.h.
|
virtual |
Appends the element to the back of the vector and returns its position.
Definition at line 188 of file CSOObjectVector.h.
Referenced by ml::CSOObjectHeap< T >::sort().
|
protectedvirtual |
Appends the element to back of vector.
It does not check whether the element is not nullptr. Do not use this method directly!
Definition at line 205 of file CSOObjectVector.h.
Referenced by ml::CSOObjectHeap< T >::insert(), and ml::CSOObjectHeap< T >::insert().
|
inline |
Returns the element at the specified position.
Definition at line 46 of file CSOObjectVector.h.
Referenced by ml::CSOObjectHeap< T >::remove(), and ml::CSOObjectHeap< T >::swap().
|
inline |
Returns the element at the specified position, and returns nullptr when out of range.
Definition at line 44 of file CSOObjectVector.h.
|
virtual |
Clears all internal pointers.
This does not delete the elements in the vector!
Definition at line 144 of file CSOObjectVector.h.
Referenced by ml::CSOObjectHeap< T >::sort(), and ml::CSOObjectHeap< T >::~CSOObjectHeap().
|
virtual |
Deletes an element at the specified position.
Definition at line 243 of file CSOObjectVector.h.
|
virtual |
Deletes the last element of the vector.
Definition at line 255 of file CSOObjectVector.h.
Referenced by ml::CSOObjectHeap< T >::remove().
|
virtual |
Deletes all elements in the vector.
This does not reset the number of elements!
Definition at line 157 of file CSOObjectVector.h.
Referenced by ml::deleteVector().
|
protectedvirtual |
Grows vector by adding an extra block of size BLOCKSIZE.
Definition at line 169 of file CSOObjectVector.h.
References T.
|
inline |
Returns the first element.
Definition at line 50 of file CSOObjectVector.h.
|
inline |
Returns the first element, and return nullptr if out of range.
Definition at line 48 of file CSOObjectVector.h.
Referenced by ml::CSOObjectHeap< T >::root().
|
inline |
Returns the last element.
Definition at line 54 of file CSOObjectVector.h.
Referenced by ml::CSOObjectHeap< T >::insert(), and ml::CSOObjectHeap< T >::insert().
|
inline |
Returns the last element, and returns nullptr if out of range.
Definition at line 52 of file CSOObjectVector.h.
|
virtual |
Searches for an element in the vector and returns its position.
Definition at line 267 of file CSOObjectVector.h.
|
inline |
Returns the number of elements in the vector.
Definition at line 42 of file CSOObjectVector.h.
Referenced by ml::CSOObjectHeap< T >::insert(), ml::CSOObjectHeap< T >::insert(), ml::CSOObjectHeap< T >::remove(), ml::CSOObjectHeap< T >::sort(), and ml::CSOObjectHeap< T >::update().
|
virtual |
Deletes an element specified by its pointer and returns its position.
Reimplemented in ml::CSOObjectHeap< T >.
Definition at line 284 of file CSOObjectVector.h.
|
virtual |
Deletes an element specified by its pointer and returns its position.
Definition at line 297 of file CSOObjectVector.h.
|
virtual |
Replaces the element at the specified position with the specified element.
Definition at line 219 of file CSOObjectVector.h.
| void ml::CSOObjectVector< T >::reserve | ( | unsigned int | init | ) |
Reserves a number of elements. It copies old elements if needed.
Definition at line 314 of file CSOObjectVector.h.
References T.
|
virtual |
Swaps two elements in the vector.
Reimplemented in ml::CSOObjectHeap< T >.
Definition at line 227 of file CSOObjectVector.h.
References T.
Referenced by ml::CSOObjectHeap< T >::swap().