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

Container with the ability to detect double inserts. More...

#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
 Appends the given element to this vector and updates the index.
 
int remove (WEMPrimitive *wp) override
 Removes the given element from vector.
 
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.
 
 WEMVector (WEMVector &&other) noexcept
 
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.
 
const WEMPrimitivefirst () const
 Returns the first element.
 
WEMPrimitivelast ()
 Returns the last element.
 
const WEMPrimitivelast () const
 Returns the last element.
 
virtual unsigned int append (WEMPrimitive *elem)
 Appends the given element to back of this vector.
 
virtual void clear ()
 Clears all internal pointers.
 
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)
 Append element to back of vector, don't check on element being non-NULL.
 

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.

◆ WEMContainer() [2/2]

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

◆ ~WEMContainer()

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

Standard destructor.

Definition at line 65 of file WEMContainer.h.

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 mlrange_cast().

◆ 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 mlrange_cast(), and T.

◆ 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.

◆ 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 mlrange_cast(), and T.

◆ 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 mlrange_cast().

◆ 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 mlrange_cast().

◆ 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 mlrange_cast().


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