ml::WEMFastVector< T > Class Template Reference

Dynamic templated vector. More...

#include <WEMFastVector.h>

List of all members.

Public Member Functions

 WEMFastVector (unsigned int init)
 Standard constructor.
virtual ~WEMFastVector ()
 Standard destructor.
unsigned int num () const
 Return number of elements in the vector.
T * at (unsigned int pos) const
 Return element at given position, return NULL when out of range.
T * first ()
 Return first element.
const T * first () const
 Return first element.
T * last ()
 Return last element.
const T * last () const
 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.
virtual void destroy ()
 Delete data.
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) const
 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 replace (T *elem, unsigned int pos)
 Replace the given position with the given element.


Detailed Description

template<class T>
class ml::WEMFastVector< T >

Dynamic templated vector.

Fast vector as a simple wrapper around a fixed size array of <T>. All elements are deleted on destruction of the vector, no need to delete elements in between!

Definition at line 29 of file WEMFastVector.h.


Constructor & Destructor Documentation

template<class T >
ml::WEMFastVector< T >::WEMFastVector ( unsigned int  init  )  [inline]

Standard constructor.

Definition at line 85 of file WEMFastVector.h.

References ML_CHECK_NEW, ML_TRACE_IN_TIME_CRITICAL, and T.

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

Standard destructor.

Definition at line 99 of file WEMFastVector.h.

References ml::WEMFastVector< T >::destroy(), ML_DELETE_ARRAY, and ML_TRACE_IN_TIME_CRITICAL.


Member Function Documentation

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

Append element to back of vector.

Definition at line 132 of file WEMFastVector.h.

References ML_TRACE_IN_TIME_CRITICAL.

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

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

Definition at line 40 of file WEMFastVector.h.

Referenced by ml::WEMFastVector< T >::lookup().

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

Clear all internal pointers.

This does not delete the elements in the vector!!

Definition at line 110 of file WEMFastVector.h.

References ML_TRACE_IN_TIME_CRITICAL.

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

Delete element at given position.

Definition at line 175 of file WEMFastVector.h.

References ml::WEMFastVector< T >::deleteLast(), ML_TRACE_IN_TIME_CRITICAL, and ml::WEMFastVector< T >::swap().

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

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

Delete last element of vector.

Definition at line 188 of file WEMFastVector.h.

References ML_TRACE_IN_TIME_CRITICAL.

Referenced by ml::WEMFastVector< T >::deleteAt(), and ml::WEMFastVector< T >::removeUnSwapped().

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

Delete data.

Definition at line 120 of file WEMFastVector.h.

References ML_DELETE, and ML_TRACE_IN_TIME_CRITICAL.

Referenced by ml::WEMFastVector< T >::~WEMFastVector().

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

Return first element.

Definition at line 44 of file WEMFastVector.h.

References boost::at().

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

Return first element.

Definition at line 42 of file WEMFastVector.h.

References boost::at().

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

Return last element.

Definition at line 48 of file WEMFastVector.h.

References boost::at().

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

Return last element.

Definition at line 46 of file WEMFastVector.h.

References boost::at().

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

Search for element in vector and return its position.

Definition at line 198 of file WEMFastVector.h.

References ml::WEMFastVector< T >::at(), and ML_TRACE_IN_TIME_CRITICAL.

Referenced by ml::WEMFastVector< T >::remove(), and ml::WEMFastVector< T >::removeUnSwapped().

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

Return number of elements in the vector.

Definition at line 38 of file WEMFastVector.h.

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

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

Definition at line 215 of file WEMFastVector.h.

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

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

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

Definition at line 227 of file WEMFastVector.h.

References ml::WEMFastVector< T >::deleteLast(), ml::WEMFastVector< T >::lookup(), and ML_TRACE_IN_TIME_CRITICAL.

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

Replace the given position with the given element.

Definition at line 148 of file WEMFastVector.h.

References ML_TRACE_IN_TIME_CRITICAL.

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

Swaps two elements in vector.

Definition at line 158 of file WEMFastVector.h.

References ML_TRACE_IN_TIME_CRITICAL, and T.

Referenced by ml::WEMFastVector< T >::deleteAt().


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

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