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

Dynamic vector, based on a memory pool. Keeps track on entry numbers of stored primitives. More...

#include <WEMIndexVector.h>

Public Member Functions

 WEMIndexVector (unsigned int init=0, unsigned int bs=8192)
 Standard constructor.
 
 WEMIndexVector (WEMIndexVector &&other) noexcept=default
 
WEMIndexVector & operator= (WEMIndexVector &&other) noexcept=default
 
 ~WEMIndexVector ()
 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, typecast from WEMPrimitive to T.
 
T * first ()
 Returns the first element of this vector.
 
const T * first () const
 Returns the first element of this vector.
 
T * append ()
 Appends an element to this vector, returns it and updates the index.
 
int remove (T *t)
 Removes the given element from vector.
 
void destroy ()
 Destroys all elements in this vector.
 
void reorder (const std::vector< unsigned int > &indexOrder)
 Sets the order by the given vector of indices.
 
void reserve (unsigned int numObjects)
 Reserves memory for the given number of objects.
 
void createNumObjects (unsigned int numObjects)
 Creates the given number of new objects.
 

Detailed Description

template<class T>
class ml::WEMIndexVector< T >

Dynamic vector, based on a memory pool. Keeps track on entry numbers of stored primitives.

Definition at line 24 of file WEMIndexVector.h.

Constructor & Destructor Documentation

◆ WEMIndexVector() [1/2]

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

Standard constructor.

Definition at line 87 of file WEMIndexVector.h.

◆ WEMIndexVector() [2/2]

template<class T >
ml::WEMIndexVector< T >::WEMIndexVector ( WEMIndexVector< T > && other)
defaultnoexcept

◆ ~WEMIndexVector()

template<class T >
ml::WEMIndexVector< T >::~WEMIndexVector ( )

Standard destructor.

Definition at line 96 of file WEMIndexVector.h.

Member Function Documentation

◆ append()

template<class T >
T * ml::WEMIndexVector< T >::append ( )

Appends an element to this vector, returns it and updates the index.

Definition at line 134 of file WEMIndexVector.h.

References ml::WEMIndexVector< T >::append(), mlrange_cast(), and T.

Referenced by ml::WEMIndexVector< T >::append().

◆ at()

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

Returns the element at the given position, typecast from WEMPrimitive to T.

Definition at line 39 of file WEMIndexVector.h.

◆ createNumObjects()

template<class T >
void ml::WEMIndexVector< T >::createNumObjects ( unsigned int numObjects)

Creates the given number of new objects.

Definition at line 213 of file WEMIndexVector.h.

References mlrange_cast(), and T.

◆ destroy()

template<class T >
void ml::WEMIndexVector< T >::destroy ( )

Destroys all elements in this vector.

Definition at line 103 of file WEMIndexVector.h.

◆ first() [1/2]

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

Returns the first element of this vector.

Definition at line 44 of file WEMIndexVector.h.

◆ first() [2/2]

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

Returns the first element of this vector.

Definition at line 49 of file WEMIndexVector.h.

◆ num()

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

Returns the number of elements in this vector.

Definition at line 34 of file WEMIndexVector.h.

◆ operator=()

template<class T >
WEMIndexVector & ml::WEMIndexVector< T >::operator= ( WEMIndexVector< T > && other)
defaultnoexcept

◆ remove()

template<class T >
int ml::WEMIndexVector< T >::remove ( T * t)

Removes the given element from vector.

Note that this is done in O(1).

Definition at line 149 of file WEMIndexVector.h.

References mlrange_cast().

◆ reorder()

template<class T >
void ml::WEMIndexVector< T >::reorder ( const std::vector< unsigned int > & indexOrder)

Sets the order by the given vector of indices.

The element in the internal vector at index i is repositioned to indexOrder[i].

Definition at line 178 of file WEMIndexVector.h.

References mlrange_cast(), and WEM_ERROR.

◆ reserve()

template<class T >
void ml::WEMIndexVector< T >::reserve ( unsigned int numObjects)

Reserves memory for the given number of objects.

Definition at line 204 of file WEMIndexVector.h.

References mlrange_cast().


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