|
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 30 of file CSOObjectVector.h.
Standard constructor.
Definition at line 134 of file CSOObjectVector.h.
References mlrange_cast(), and T.
|
virtual |
Standard destructor.
Definition at line 147 of file CSOObjectVector.h.
Appends the element to the back of the vector and returns its position.
Definition at line 193 of file CSOObjectVector.h.
References mlrange_cast().
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 207 of file CSOObjectVector.h.
References mlrange_cast().
Referenced by ml::CSOObjectHeap< T >::insert(), and ml::CSOObjectHeap< T >::insert().
Returns the element at the specified position.
Definition at line 50 of file CSOObjectVector.h.
Referenced by ml::CSOObjectHeap< T >::remove(), and ml::CSOObjectHeap< T >::swap().
Returns the element at the specified position, and returns nullptr when out of range.
Definition at line 45 of file CSOObjectVector.h.
|
virtual |
Clears all internal pointers.
This does not delete the elements in the vector!
Definition at line 154 of file CSOObjectVector.h.
Referenced by ml::CSOObjectHeap< T >::sort(), and ml::CSOObjectHeap< T >::~CSOObjectHeap().
Deletes an element at the specified position.
Definition at line 240 of file CSOObjectVector.h.
|
virtual |
Deletes the last element of the vector.
Definition at line 250 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 165 of file CSOObjectVector.h.
References mlrange_cast().
Referenced by ml::deleteVector().
|
protectedvirtual |
Grows vector by adding an extra block of size BLOCKSIZE.
Definition at line 176 of file CSOObjectVector.h.
References mlrange_cast(), and T.
|
inline |
Returns the first element.
Definition at line 60 of file CSOObjectVector.h.
|
inline |
Returns the first element, and return nullptr if out of range.
Definition at line 55 of file CSOObjectVector.h.
Referenced by ml::CSOObjectHeap< T >::root().
|
inline |
Returns the last element.
Definition at line 70 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 65 of file CSOObjectVector.h.
Searches for an element in the vector and returns its position.
Definition at line 260 of file CSOObjectVector.h.
References mlrange_cast().
Returns the number of elements in the vector.
Definition at line 40 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().
Deletes an element specified by its pointer and returns its position.
Reimplemented in ml::CSOObjectHeap< T >.
Definition at line 274 of file CSOObjectVector.h.
References mlrange_cast().
Deletes an element specified by its pointer and returns its position.
Definition at line 285 of file CSOObjectVector.h.
References mlrange_cast().
Replaces the element at the specified position with the specified element.
Definition at line 219 of file CSOObjectVector.h.
References mlrange_cast().
Reserves a number of elements. It copies old elements if needed.
Definition at line 299 of file CSOObjectVector.h.
References mlrange_cast(), and T.
Swaps two elements in the vector.
Reimplemented in ml::CSOObjectHeap< T >.
Definition at line 226 of file CSOObjectVector.h.
References mlrange_cast(), and T.
Referenced by ml::CSOObjectHeap< T >::swap().