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>

List of all members.

Public Member Functions

 CSOObjectVector (unsigned int init=0, unsigned int bs=65535)
 Standard constructor.
virtual ~CSOObjectVector ()
 Standard destructor.
unsigned int num () const
 Return number of elements in the vector.
T * atBoundsCheck (unsigned int pos)
 Return element at given position, return NULL when out of range.
T * at (unsigned int pos) const
 Return element at given position.
T * firstBoundsCheck ()
 Return first element, return NULL when out of range.
T * first ()
 Return first element.
T * lastBoundsCheck ()
 Return last element, return NULL when out of range.
T * last ()
 Return last element.
virtual unsigned int append (T *elem)
 Append element to back of vector.
virtual void swap (unsigned int p1, unsigned int p2)
 Swaps two elements in vector.
virtual void clear ()
 Clear all internal pointers This does not delete the elements in the vector!!
virtual void deleteAt (unsigned int pos)
 Delete element at given position.
virtual void deleteLast ()
 Delete last element of vector.
virtual int remove (T *elem)
 Delete element given by its pointer, search element and delete.
virtual int lookup (T *elem)
 Search for element in vector and return its position.
virtual int removeUnSwapped (T *elem)
 Delete element given by its pointer, search element and delete, keep order of elements!
virtual void destroy ()
 Delete all elements in the vector This does not reset the number of elements!!
virtual void replace (T *elem, unsigned int pos)
 Replace the given position with the given element.
void reserve (unsigned int init)
 Reserve num elements, copy old ones if needed.

Protected Member Functions

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


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 28 of file CSOObjectVector.h.


Constructor & Destructor Documentation

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

Standard constructor.

Definition at line 113 of file CSOObjectVector.h.

References ML_CHECK_NEW, ML_TRACE_IN, and T.

template<class T >
ml::CSOObjectVector< T >::~CSOObjectVector (  )  [inline, virtual]

Standard destructor.

Definition at line 129 of file CSOObjectVector.h.

References ML_TRACE_IN_TIME_CRITICAL.


Member Function Documentation

template<class T>
unsigned int ml::CSOObjectVector< T >::append ( T *  elem  )  [inline, virtual]

Append element to back of vector.

Definition at line 182 of file CSOObjectVector.h.

References ML_TRACE_IN_TIME_CRITICAL.

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

template<class T>
unsigned int ml::CSOObjectVector< T >::appendUnsafe ( T *  elem  )  [inline, protected, virtual]

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

Definition at line 197 of file CSOObjectVector.h.

References ml::CSOObjectVector< T >::expand(), and ML_TRACE_IN_TIME_CRITICAL.

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

Return element at given position.

Definition at line 43 of file CSOObjectVector.h.

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

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

Definition at line 41 of file CSOObjectVector.h.

template<class T >
void ml::CSOObjectVector< T >::clear ( void   )  [inline, virtual]

Clear all internal pointers This does not delete the elements in the vector!!

Definition at line 139 of file CSOObjectVector.h.

References ML_DELETE_ARRAY, and ML_TRACE_IN.

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

Delete element at given position.

Definition at line 237 of file CSOObjectVector.h.

References ML_TRACE_IN_TIME_CRITICAL.

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

template<class T >
void ml::CSOObjectVector< T >::deleteLast (  )  [inline, virtual]

Delete last element of vector.

Definition at line 248 of file CSOObjectVector.h.

References ML_TRACE_IN_TIME_CRITICAL.

template<class T >
void ml::CSOObjectVector< T >::destroy (  )  [inline, virtual]

Delete all elements in the vector This does not reset the number of elements!!

Definition at line 152 of file CSOObjectVector.h.

References ML_DELETE, and ML_TRACE_IN.

Referenced by ml::deleteVector().

template<class T >
void ml::CSOObjectVector< T >::expand (  )  [inline, protected, virtual]

Grow vector, add extra block of size BLOCKSIZE.

Definition at line 165 of file CSOObjectVector.h.

References ML_CHECK_NEW, ML_DELETE_ARRAY, ML_TRACE_IN, and T.

Referenced by ml::CSOObjectVector< T >::appendUnsafe().

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

Return first element.

Definition at line 47 of file CSOObjectVector.h.

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

Return first element, return NULL when out of range.

Definition at line 45 of file CSOObjectVector.h.

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

Return last element.

Definition at line 51 of file CSOObjectVector.h.

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

Return last element, return NULL when out of range.

Definition at line 49 of file CSOObjectVector.h.

template<class T>
int ml::CSOObjectVector< T >::lookup ( T *  elem  )  [inline, virtual]

Search for element in vector and return its position.

Definition at line 261 of file CSOObjectVector.h.

References boost::at(), and ML_TRACE_IN_TIME_CRITICAL.

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

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

Return number of elements in the vector.

Definition at line 39 of file CSOObjectVector.h.

template<class T>
int ml::CSOObjectVector< T >::remove ( T *  elem  )  [inline, virtual]

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

Reimplemented in ml::CSOObjectHeap< T >, and ml::CSOObjectHeap< CSOLiveWireNode >.

Definition at line 278 of file CSOObjectVector.h.

References ml::CSOObjectVector< T >::deleteAt(), ml::CSOObjectVector< T >::lookup(), and ML_TRACE_IN_TIME_CRITICAL.

template<class T>
int ml::CSOObjectVector< T >::removeUnSwapped ( T *  elem  )  [inline, virtual]

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

Definition at line 290 of file CSOObjectVector.h.

References ML_TRACE_IN_TIME_CRITICAL.

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

Replace the given position with the given element.

Definition at line 210 of file CSOObjectVector.h.

References ML_TRACE_IN_TIME_CRITICAL.

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

Reserve num elements, copy old ones if needed.

Definition at line 307 of file CSOObjectVector.h.

References ML_CHECK_NEW, ML_DELETE_ARRAY, ML_TRACE_IN, and T.

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

Swaps two elements in vector.

Reimplemented in ml::CSOObjectHeap< T >, and ml::CSOObjectHeap< CSOLiveWireNode >.

Definition at line 220 of file CSOObjectVector.h.

References ML_TRACE_IN_TIME_CRITICAL, and T.


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

Generated on Sat Sep 3 18:39:42 2011 for MeVisLab Toolbox Reference by  doxygen 1.5.8