MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
ml::WEMFastVector< T > Class Template Reference

Dynamic templated vector. More...

#include <WEMFastVector.h>

Public Member Functions

 WEMFastVector (unsigned int init)
 Standard constructor.
 
virtual ~WEMFastVector ()
 Standard destructor.
 
unsigned int num () const
 Returns the number of elements in this vector.
 
T * at (unsigned int pos) const
 Returns the element at the given position, returns NULL if out of range.
 
T * first ()
 Returns the first element.
 
const T * first () const
 Returns the first element.
 
T * last ()
 Returns the last element.
 
const T * last () const
 Returns the last element.
 
virtual unsigned int append (T *elem)
 Appends the given element to the back of this vector.
 
virtual void swap (unsigned int p1, unsigned int p2)
 Swaps the two given elements in this vector.
 
virtual void clear ()
 Clears all internal pointers.
 
virtual void destroy ()
 Deletes all data.
 
virtual void deleteAt (unsigned int pos)
 Deletes the element at the given position.
 
virtual void deleteLast ()
 Deletes the last element of this vector.
 
virtual int remove (T *elem)
 Deletes the element given by its pointer.
 
virtual int lookup (T *elem) const
 Searches for the element in this vector and returns its position.
 
virtual int removeUnSwapped (T *elem)
 Deletes the element given by its pointer, searches the element and deletes it, but keeps the order of elements.
 
virtual void replace (T *elem, unsigned int pos)
 Replaces the element at 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 25 of file WEMFastVector.h.

Constructor & Destructor Documentation

◆ WEMFastVector()

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

Standard constructor.

Definition at line 97 of file WEMFastVector.h.

References mlrange_cast(), and T.

◆ ~WEMFastVector()

template<class T >
ml::WEMFastVector< T >::~WEMFastVector ( )
virtual

Standard destructor.

Definition at line 110 of file WEMFastVector.h.

Member Function Documentation

◆ append()

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

Appends the given element to the back of this vector.

Definition at line 138 of file WEMFastVector.h.

References mlrange_cast().

◆ at()

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

Returns the element at the given position, returns NULL if out of range.

Definition at line 38 of file WEMFastVector.h.

◆ clear()

template<class T >
void ml::WEMFastVector< T >::clear ( )
virtual

Clears all internal pointers.

This does not delete the elements in the vector!

Definition at line 119 of file WEMFastVector.h.

◆ deleteAt()

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

Deletes the element at the given position.

Definition at line 172 of file WEMFastVector.h.

◆ deleteLast()

template<class T >
void ml::WEMFastVector< T >::deleteLast ( )
virtual

Deletes the last element of this vector.

Definition at line 186 of file WEMFastVector.h.

◆ destroy()

template<class T >
void ml::WEMFastVector< T >::destroy ( )
virtual

Deletes all data.

Definition at line 126 of file WEMFastVector.h.

References mlrange_cast().

◆ first() [1/2]

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

Returns the first element.

Definition at line 43 of file WEMFastVector.h.

◆ first() [2/2]

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

Returns the first element.

Definition at line 48 of file WEMFastVector.h.

◆ last() [1/2]

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

Returns the last element.

Definition at line 53 of file WEMFastVector.h.

◆ last() [2/2]

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

Returns the last element.

Definition at line 58 of file WEMFastVector.h.

◆ lookup()

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

Searches for the element in this vector and returns its position.

Definition at line 195 of file WEMFastVector.h.

References mlrange_cast().

◆ num()

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

Returns the number of elements in this vector.

Definition at line 33 of file WEMFastVector.h.

◆ remove()

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

Deletes the element given by its pointer.

Definition at line 209 of file WEMFastVector.h.

References mlrange_cast().

◆ removeUnSwapped()

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

Deletes the element given by its pointer, searches the element and deletes it, but keeps the order of elements.

Definition at line 220 of file WEMFastVector.h.

References mlrange_cast().

◆ replace()

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

Replaces the element at the given position with the given element.

Definition at line 151 of file WEMFastVector.h.

References mlrange_cast().

◆ swap()

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

Swaps the two given elements in this vector.

Definition at line 158 of file WEMFastVector.h.

References mlrange_cast(), and T.


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