ug4
ug::AttachmentDataContainer< T > Class Template Reference

A generic specialization of IAttachedDataContainer. More...

#include <attachment_pipe.h>

+ Inheritance diagram for ug::AttachmentDataContainer< T >:

Public Types

typedef T ValueType
 

Public Member Functions

 AttachmentDataContainer (const T &defaultValue=T())
 
virtual void copy_data (size_t indFrom, size_t indTo)
 copy data from entry indFrom to entry indTo. More...
 
virtual void copy_to_container (IAttachmentDataContainer *pDestCon, int *indexMap, int num) const
 
virtual void defragment (size_t *pNewIndices, size_t numValidElements)
 
TRef get_elem (size_t index)
 
TConstRef get_elem (size_t index) const
 
virtual size_t occupied_memory ()
 returns the memory occupied by the container More...
 
TRef operator[] (size_t index)
 
TConstRef operator[] (size_t index) const
 
virtual void reset_entry (size_t index)
 resets the entry to its default value. More...
 
virtual void resize (size_t iSize)
 resize the data array More...
 
virtual size_t size ()
 returns the size of the data-array. More...
 
void swap (AttachmentDataContainer< T > &container)
 swaps the buffer content of associated data More...
 
virtual ~AttachmentDataContainer ()
 
- Public Member Functions inherited from ug::IAttachmentDataContainer
virtual ~IAttachmentDataContainer ()
 

Protected Member Functions

DataContainerget_data_container ()
 

Protected Attributes

m_defaultValue
 
DataContainer m_vData
 

Private Types

typedef AttachmentDataContainer< T > ClassType
 
typedef std::vector< T > DataContainer
 
typedef attachment_value_traits< T >::const_reference TConstRef
 
typedef attachment_value_traits< T >::reference TRef
 

Detailed Description

template<class T>
class ug::AttachmentDataContainer< T >

A generic specialization of IAttachedDataContainer.

This template-class not only simplifies the creation of custom containers, it also defines some types, operators and values, which are essential to use an AttachmentDataContainer with libGrid. In particular libGrids AttachmentAccessors require these definitions.

Member Typedef Documentation

◆ ClassType

template<class T >
typedef AttachmentDataContainer<T> ug::AttachmentDataContainer< T >::ClassType
private

◆ DataContainer

template<class T >
typedef std::vector<T> ug::AttachmentDataContainer< T >::DataContainer
private

◆ TConstRef

template<class T >
typedef attachment_value_traits<T>::const_reference ug::AttachmentDataContainer< T >::TConstRef
private

◆ TRef

template<class T >
typedef attachment_value_traits<T>::reference ug::AttachmentDataContainer< T >::TRef
private

◆ ValueType

template<class T >
typedef T ug::AttachmentDataContainer< T >::ValueType

Constructor & Destructor Documentation

◆ AttachmentDataContainer()

template<class T >
ug::AttachmentDataContainer< T >::AttachmentDataContainer ( const T &  defaultValue = T())
inline

◆ ~AttachmentDataContainer()

template<class T >
virtual ug::AttachmentDataContainer< T >::~AttachmentDataContainer ( )
inlinevirtual

Member Function Documentation

◆ copy_data()

template<class T >
virtual void ug::AttachmentDataContainer< T >::copy_data ( size_t  indFrom,
size_t  indTo 
)
inlinevirtual

copy data from entry indFrom to entry indTo.

Implements ug::IAttachmentDataContainer.

◆ copy_to_container()

template<class T >
virtual void ug::AttachmentDataContainer< T >::copy_to_container ( IAttachmentDataContainer< T > *  pDestCon,
int *  indexMap,
int  num 
) const
inlinevirtual

copies entries from the this-container to the container specified by pDestCon. For the i-th entry in the target container, pIndexMap has to contain the index of the associated source entry in this container. num specifies the number of entries to be copied. Make sure, that pDest can hold 'num' elements.

pDestCon has to have the same or a derived dynamic type as the container on which this method is called.

Implements ug::IAttachmentDataContainer.

References ug::AttachmentDataContainer< T >::get_data_container().

◆ defragment()

template<class T >
virtual void ug::AttachmentDataContainer< T >::defragment ( size_t *  pNewIndices,
size_t  numValidElements 
)
inlinevirtual

defragment should clear the containers data from unused entries. pNewIndices should be an array of indices, wich holds a new index for each entry in IAttachedDataContainer. pNewIndices has thus to hold as many indices as there are entries in IAttachedDataContainer. If an entry shall not appear in the defragmented container, its new index has to be set to INVALID_ATTACHMENT_INDEX. numValidElements has to specify the size of the defragmented container - it thus has to equal the number of valid indices in pNewIndices.

Implements ug::IAttachmentDataContainer.

References ug::INVALID_ATTACHMENT_INDEX.

◆ get_data_container()

template<class T >
DataContainer& ug::AttachmentDataContainer< T >::get_data_container ( )
inlineprotected

◆ get_elem() [1/2]

template<class T >
TRef ug::AttachmentDataContainer< T >::get_elem ( size_t  index)
inline

◆ get_elem() [2/2]

template<class T >
TConstRef ug::AttachmentDataContainer< T >::get_elem ( size_t  index) const
inline

Referenced by ug::Grid::reset_marks().

◆ occupied_memory()

template<class T >
virtual size_t ug::AttachmentDataContainer< T >::occupied_memory ( )
inlinevirtual

returns the memory occupied by the container

Implements ug::IAttachmentDataContainer.

◆ operator[]() [1/2]

template<class T >
TRef ug::AttachmentDataContainer< T >::operator[] ( size_t  index)
inline

◆ operator[]() [2/2]

template<class T >
TConstRef ug::AttachmentDataContainer< T >::operator[] ( size_t  index) const
inline

◆ reset_entry()

template<class T >
virtual void ug::AttachmentDataContainer< T >::reset_entry ( size_t  index)
inlinevirtual

resets the entry to its default value.

Implements ug::IAttachmentDataContainer.

◆ resize()

template<class T >
virtual void ug::AttachmentDataContainer< T >::resize ( size_t  iSize)
inlinevirtual

resize the data array

Implements ug::IAttachmentDataContainer.

◆ size()

template<class T >
virtual size_t ug::AttachmentDataContainer< T >::size ( )
inlinevirtual

returns the size of the data-array.

Implements ug::IAttachmentDataContainer.

Referenced by ug::Grid::reset_marks().

◆ swap()

template<class T >
void ug::AttachmentDataContainer< T >::swap ( AttachmentDataContainer< T > &  container)
inline

swaps the buffer content of associated data

References ug::AttachmentDataContainer< T >::m_vData.

Member Data Documentation

◆ m_defaultValue

template<class T >
T ug::AttachmentDataContainer< T >::m_defaultValue
protected

◆ m_vData

template<class T >
DataContainer ug::AttachmentDataContainer< T >::m_vData
protected

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