MeVisLab Toolbox Reference
ml::CSOObjectVector< T > Class Template Reference

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. More...

#include <CSOObjectVector.h>

Inheritance diagram for ml::CSOObjectVector< T >:
ml::CSOObjectHeap< T >

Public Member Functions

 CSOObjectVector (unsigned int init=0, unsigned int bs=65535)
 Standard constructor. More...
 
virtual ~CSOObjectVector ()
 Standard destructor. More...
 
unsigned int num () const
 Returns number of elements in the vector. More...
 
TatBoundsCheck (unsigned int pos) const
 Returns element at given position, return NULL when out of range. More...
 
Tat (unsigned int pos) const
 Returns element at given position. More...
 
TfirstBoundsCheck () const
 Returns first element, return NULL when out of range. More...
 
Tfirst () const
 Returns first element. More...
 
TlastBoundsCheck () const
 Returns last element, return NULL when out of range. More...
 
Tlast () const
 Returns last element. More...
 
virtual unsigned int append (T *elem)
 Appends element to back of vector. More...
 
virtual void swap (unsigned int p1, unsigned int p2)
 Swaps two elements in vector. More...
 
virtual void clear ()
 Clears all internal pointers This does not delete the elements in the vector!! More...
 
virtual void deleteAt (unsigned int pos)
 Deletes element at given position. More...
 
virtual void deleteLast ()
 Deletes last element of vector. More...
 
virtual int remove (T *elem)
 Deletes element given by its pointer, search element and delete. More...
 
virtual int lookup (T *elem) const
 Searches for element in vector and return its position. More...
 
virtual int removeUnSwapped (T *elem)
 Deletes element given by its pointer, search element and delete, keep order of elements! More...
 
virtual void destroy ()
 Deletes all elements in the vector This does not reset the number of elements!! More...
 
virtual void replace (T *elem, unsigned int pos)
 Replaces the given position with the given element. More...
 
void reserve (unsigned int init)
 Reserves num elements, copy old ones if needed. More...
 

Protected Member Functions

virtual void expand ()
 Grows vector, add extra block of size BLOCKSIZE. More...
 
virtual unsigned int appendUnsafe (T *elem)
 Appends element to back of vector, don't check on element being non-NULL Don't use this function directly!! More...
 

Detailed Description

template<class T>
class ml::CSOObjectVector< T >

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.

Constructor & Destructor Documentation

◆ CSOObjectVector()

template<class T >
ml::CSOObjectVector< T >::CSOObjectVector ( unsigned int  init = 0,
unsigned int  bs = 65535 
)

Standard constructor.

Definition at line 121 of file CSOObjectVector.h.

References ml::library::init(), and T.

◆ ~CSOObjectVector()

template<class T >
ml::CSOObjectVector< T >::~CSOObjectVector
virtual

Standard destructor.

Definition at line 136 of file CSOObjectVector.h.

Member Function Documentation

◆ append()

template<class T >
unsigned int ml::CSOObjectVector< T >::append ( T elem)
virtual

Appends element to back of vector.

Definition at line 188 of file CSOObjectVector.h.

Referenced by ml::CSOObjectHeap< T >::sort().

◆ appendUnsafe()

template<class T >
unsigned int ml::CSOObjectVector< T >::appendUnsafe ( T elem)
protectedvirtual

Appends element to back of vector, don't check on element being non-NULL Don't use this function directly!!

Definition at line 205 of file CSOObjectVector.h.

Referenced by ml::CSOObjectHeap< T >::insert().

◆ at()

template<class T >
T* ml::CSOObjectVector< T >::at ( unsigned int  pos) const
inline

Returns element at given position.

Definition at line 46 of file CSOObjectVector.h.

Referenced by ml::CSOObjectHeap< T >::remove(), and ml::CSOObjectHeap< T >::swap().

◆ atBoundsCheck()

template<class T >
T* ml::CSOObjectVector< T >::atBoundsCheck ( unsigned int  pos) const
inline

Returns element at given position, return NULL when out of range.

Definition at line 44 of file CSOObjectVector.h.

◆ clear()

template<class T >
void ml::CSOObjectVector< T >::clear ( void  )
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().

◆ deleteAt()

template<class T >
void ml::CSOObjectVector< T >::deleteAt ( unsigned int  pos)
virtual

Deletes element at given position.

Definition at line 243 of file CSOObjectVector.h.

◆ deleteLast()

template<class T >
void ml::CSOObjectVector< T >::deleteLast
virtual

Deletes last element of vector.

Definition at line 255 of file CSOObjectVector.h.

Referenced by ml::CSOObjectHeap< T >::remove().

◆ destroy()

template<class T >
void ml::CSOObjectVector< T >::destroy
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().

◆ expand()

template<class T >
void ml::CSOObjectVector< T >::expand
protectedvirtual

Grows vector, add extra block of size BLOCKSIZE.

Definition at line 169 of file CSOObjectVector.h.

References T.

◆ first()

template<class T >
T* ml::CSOObjectVector< T >::first ( ) const
inline

Returns first element.

Definition at line 50 of file CSOObjectVector.h.

References boost::at().

◆ firstBoundsCheck()

template<class T >
T* ml::CSOObjectVector< T >::firstBoundsCheck ( ) const
inline

Returns first element, return NULL when out of range.

Definition at line 48 of file CSOObjectVector.h.

Referenced by ml::CSOObjectHeap< T >::root().

◆ last()

template<class T >
T* ml::CSOObjectVector< T >::last ( ) const
inline

Returns last element.

Definition at line 54 of file CSOObjectVector.h.

References boost::at().

Referenced by ml::CSOObjectHeap< T >::insert().

◆ lastBoundsCheck()

template<class T >
T* ml::CSOObjectVector< T >::lastBoundsCheck ( ) const
inline

Returns last element, return NULL when out of range.

Definition at line 52 of file CSOObjectVector.h.

◆ lookup()

template<class T >
int ml::CSOObjectVector< T >::lookup ( T elem) const
virtual

Searches for element in vector and return its position.

Definition at line 267 of file CSOObjectVector.h.

References boost::at().

◆ num()

template<class T >
unsigned int ml::CSOObjectVector< T >::num ( ) const
inline

Returns number of elements in the vector.

Definition at line 42 of file CSOObjectVector.h.

Referenced by ml::CSOObjectHeap< T >::insert(), ml::CSOObjectHeap< T >::remove(), ml::CSOObjectHeap< T >::sort(), and ml::CSOObjectHeap< T >::update().

◆ remove()

template<class T >
int ml::CSOObjectVector< T >::remove ( T elem)
virtual

Deletes element given by its pointer, search element and delete.

Reimplemented in ml::CSOObjectHeap< T >.

Definition at line 284 of file CSOObjectVector.h.

◆ removeUnSwapped()

template<class T >
int ml::CSOObjectVector< T >::removeUnSwapped ( T elem)
virtual

Deletes element given by its pointer, search element and delete, keep order of elements!

Definition at line 297 of file CSOObjectVector.h.

◆ replace()

template<class T >
void ml::CSOObjectVector< T >::replace ( T elem,
unsigned int  pos 
)
virtual

Replaces the given position with the given element.

Definition at line 219 of file CSOObjectVector.h.

◆ reserve()

template<class T >
void ml::CSOObjectVector< T >::reserve ( unsigned int  init)

Reserves num elements, copy old ones if needed.

Definition at line 314 of file CSOObjectVector.h.

References ml::library::init(), and T.

◆ swap()

template<class T >
void ml::CSOObjectVector< T >::swap ( unsigned int  p1,
unsigned int  p2 
)
virtual

Swaps two elements in vector.

Reimplemented in ml::CSOObjectHeap< T >.

Definition at line 227 of file CSOObjectVector.h.

References T.

Referenced by ml::CSOObjectHeap< T >::swap().


The documentation for this class was generated from the following file: