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

Additional Inherited Members

- Protected Member Functions inherited from ml::WEMVector< WEMPrimitive >
virtual void expand ()
 Grow vector, add extra block of size BLOCKSIZE. More...
 
virtual unsigned int appendUnsafe (WEMPrimitive *elem)
 Append element to back of vector, don't check on element being non-NULL. More...
 

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 ml::WEMPrimitive::getHeapPosition().

◆ 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 boost::at(), 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.

References boost::at().

◆ 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 boost::at(), 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 boost::at(), and ml::WEMPrimitive::getHeapPosition().

◆ 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 ml::WEMPrimitive::setHeapPosition().

◆ 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 boost::at().


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