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

#include <WEMContainer.h>

Inheritance diagram for ml::WEMContainer< T >:
ml::WEMVector< WEMPrimitive >

Public Member Functions

 WEMContainer (unsigned int init=0)
 Standard constructor.
 WEMContainer (WEMContainer &&) noexcept=default
WEMContaineroperator= (WEMContainer &&) noexcept=default
 ~WEMContainer () override
 Standard destructor.
Tat (unsigned int pos)
 Returns the element at the given position, typecast from WEMPrimitive to T.
const Tat (unsigned int pos) const
 Returns the element at the given position, typecast from WEMPrimitive to T.
void swap (unsigned int i, unsigned int j) override
 Swaps elements and updates their indices.
unsigned int append (WEMPrimitive *wp) override
int remove (WEMPrimitive *wp) override
void replace (WEMPrimitive *wp, unsigned int pos) override
 Replaces the given element at the given position, updates index.
void destroy () override
 Destroys all elements in this vector.
Public Member Functions inherited from ml::WEMVector< WEMPrimitive >
 WEMVector (unsigned int init=0)
 Standard constructor.
WEMVectoroperator= (WEMVector &&other) noexcept
virtual ~WEMVector ()
 Standard destructor.
unsigned int num () const
 Returns the number of elements in this vector.
WEMPrimitiveat (unsigned int pos) const
 Returns the element at the given position or returns NULL if out of range.
WEMPrimitivefirst ()
 Returns the first element.
WEMPrimitivelast ()
 Returns the last element.
virtual unsigned int append (WEMPrimitive *elem)
 Appends the given element to back of this vector.
virtual void clear ()
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 (WEMPrimitive *elem)
 Deletes the element given by its pointer.
virtual int lookup (WEMPrimitive *elem) const
 Searches for the given element in this vector and returns its position.
virtual int removeUnSwapped (WEMPrimitive *elem)
 Deletes the element given by its pointer. Keeps the order of the elements!
virtual void replace (WEMPrimitive *elem, unsigned int pos)
 Replaces the given position with the given element.
void reserve (unsigned int init)
 Reserves init elements, copies old ones if existing.

Additional Inherited Members

Protected Member Functions inherited from ml::WEMVector< WEMPrimitive >
virtual void expand ()
 Grow vector, add extra block of size BLOCKSIZE.
virtual unsigned int appendUnsafe (WEMPrimitive *elem)

Detailed Description

template<class T>
class ml::WEMContainer< T >

Container with the ability to detect double inserts. Uses _heapPosition to prevent conflicts with _entryNumber.

Definition at line 26 of file WEMContainer.h.

Constructor & Destructor Documentation

◆ WEMContainer() [1/2]

template<class T>
ml::WEMContainer< T >::WEMContainer ( unsigned int init = 0)

Standard constructor.

Definition at line 57 of file WEMContainer.h.

References T, WEMContainer(), and ml::WEMVector< WEMPrimitive >::WEMVector().

Referenced by operator=(), WEMContainer(), and WEMContainer().

◆ WEMContainer() [2/2]

template<class T>
ml::WEMContainer< T >::WEMContainer ( WEMContainer< T > && )
defaultnoexcept

References WEMContainer().

◆ ~WEMContainer()

template<class T>
ml::WEMContainer< T >::~WEMContainer ( )
override

Standard destructor.

Definition at line 65 of file WEMContainer.h.

References ~WEMContainer().

Referenced by ~WEMContainer().

Member Function Documentation

◆ append()

template<class T>
unsigned int ml::WEMContainer< T >::append ( WEMPrimitive * wp)
override

Appends the given element to this vector and updates the index. Only works if element is not yet in vector!

Definition at line 131 of file WEMContainer.h.

References append(), ml::WEMVector< T, fixedBufferSize >::appendUnsafe(), ml::WEMPrimitive::getHeapPosition(), ml::WEMVector< WEMPrimitive >::last(), and ml::WEMVector< WEMPrimitive >::num().

Referenced by append(), and operator=().

◆ at() [1/2]

template<class T>
T * ml::WEMContainer< T >::at ( unsigned int pos)

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

Definition at line 72 of file WEMContainer.h.

References at(), ml::WEMVector< T, fixedBufferSize >::at(), and T.

Referenced by at(), at(), destroy(), operator=(), remove(), and swap().

◆ at() [2/2]

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

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

Definition at line 88 of file WEMContainer.h.

References at(), and T.

◆ destroy()

template<class T>
void ml::WEMContainer< T >::destroy ( )
overridevirtual

Destroys all elements in this vector.

Reimplemented from ml::WEMVector< WEMPrimitive >.

Definition at line 96 of file WEMContainer.h.

References at(), ml::WEMVector< WEMPrimitive >::clear(), destroy(), ml::WEMVector< WEMPrimitive >::num(), ml::WEMVector< T, fixedBufferSize >::replace(), and T.

Referenced by destroy(), and operator=().

◆ operator=()

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

◆ remove()

template<class T>
int ml::WEMContainer< T >::remove ( WEMPrimitive * wp)
override

Removes the given element from vector. Note that this is done in O(1)!

Definition at line 156 of file WEMContainer.h.

References at(), ml::WEMVector< WEMPrimitive >::deleteLast(), ml::WEMPrimitive::getHeapPosition(), ml::WEMVector< WEMPrimitive >::num(), remove(), and swap().

Referenced by operator=(), and remove().

◆ replace()

template<class T>
void ml::WEMContainer< T >::replace ( WEMPrimitive * wp,
unsigned int pos )
override

Replaces the given element at the given position, updates index.

Definition at line 144 of file WEMContainer.h.

References replace(), ml::WEMVector< T, fixedBufferSize >::replace(), and ml::WEMPrimitive::setHeapPosition().

Referenced by operator=(), and replace().

◆ swap()

template<class T>
void ml::WEMContainer< T >::swap ( unsigned int i,
unsigned int j )
overridevirtual

Swaps elements and updates their indices.

Reimplemented from ml::WEMVector< WEMPrimitive >.

Definition at line 121 of file WEMContainer.h.

References at(), swap(), and ml::WEMVector< T, fixedBufferSize >::swap().

Referenced by operator=(), remove(), and swap().


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