AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::slam::DynamicMap< SetType, DataType > Class Template Reference

A slam map class that supports adding and removing entries. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.5.0/src/axom/slam/DynamicMap.hpp>

Public Types

using SetPosition = typename SetType::PositionType
 
using SetElement = typename SetType::ElementType
 
using OrderedMap = std::vector< DataType >
 

Public Member Functions

 DynamicMap ()
 Default constructor. More...
 
 DynamicMap (SetType *theSet)
 Constructor from a set pointer. More...
 
 DynamicMap (SetType *theSet, DataType defaultValue)
 Constructor from a set pointer. More...
 
 ~DynamicMap ()
 
const SetType * set () const
 Returns a pointer to the map's underlying set. More...
 
OrderedMapdata ()
 Access to underlying data. More...
 
const OrderedMapdata () const
 Const access to underlying data. More...
 
DynamicMap individual access functions
const DataType & operator[] (SetPosition setIndex) const
 Return the value at set index setIndex. More...
 
DynamicMap cardinality functions
SetPosition size () const
 Returns the size of map's set. More...
 
SetPosition numberOfValidEntries () const
 Return the number of valid entries. More...
 
DynamicMap validity check functions
bool isValidEntry (SetPosition pos) const
 
bool isValid (bool verboseOutput=false) const
 Predicate to check if this DynamicMap instance is valid. More...
 
Functions that modify the map's cardinality
DataType & operator[] (SetPosition position)
 Get the value at position position. More...
 
void insert (SetPosition position, DataType value)
 Insert vale value into position position in the map. More...
 
void resize (SetPosition s)
 Resizes the map to have at least s positions. More...
 

Detailed Description

template<typename SetType, typename DataType>
class axom::slam::DynamicMap< SetType, DataType >

A slam map class that supports adding and removing entries.

An entry in the map is considered valid if its corresponding set's entry is valid

Member Typedef Documentation

◆ SetPosition

template<typename SetType , typename DataType >
using axom::slam::DynamicMap< SetType, DataType >::SetPosition = typename SetType::PositionType

◆ SetElement

template<typename SetType , typename DataType >
using axom::slam::DynamicMap< SetType, DataType >::SetElement = typename SetType::ElementType

◆ OrderedMap

template<typename SetType , typename DataType >
using axom::slam::DynamicMap< SetType, DataType >::OrderedMap = std::vector<DataType>

Constructor & Destructor Documentation

◆ DynamicMap() [1/3]

template<typename SetType , typename DataType >
axom::slam::DynamicMap< SetType, DataType >::DynamicMap ( )
inline

Default constructor.

◆ DynamicMap() [2/3]

template<typename SetType , typename DataType >
axom::slam::DynamicMap< SetType, DataType >::DynamicMap ( SetType *  theSet)
inline

Constructor from a set pointer.

Parameters
theSetA pointer to the map's set

The map will be allocated with theSet->size() entries. There is no guarantee that the values will be initialized

◆ DynamicMap() [3/3]

template<typename SetType , typename DataType >
axom::slam::DynamicMap< SetType, DataType >::DynamicMap ( SetType *  theSet,
DataType  defaultValue 
)
inline

Constructor from a set pointer.

Parameters
theSetA pointer to the map's set
defaultValueThe value that each entry in the map will be initialized

The map will be allocated with theSet->size() entries. Each entry will have value defaultValue

◆ ~DynamicMap()

template<typename SetType , typename DataType >
axom::slam::DynamicMap< SetType, DataType >::~DynamicMap ( )
inline

Member Function Documentation

◆ set()

template<typename SetType , typename DataType >
const SetType* axom::slam::DynamicMap< SetType, DataType >::set ( ) const
inline

Returns a pointer to the map's underlying set.

◆ operator[]() [1/2]

template<typename SetType , typename DataType >
const DataType& axom::slam::DynamicMap< SetType, DataType >::operator[] ( SetPosition  setIndex) const
inline

Return the value at set index setIndex.

Referenced by axom::slam::DynamicMap< SetType, DataType >::insert().

◆ data() [1/2]

template<typename SetType , typename DataType >
OrderedMap& axom::slam::DynamicMap< SetType, DataType >::data ( )
inline

Access to underlying data.

◆ data() [2/2]

template<typename SetType , typename DataType >
const OrderedMap& axom::slam::DynamicMap< SetType, DataType >::data ( ) const
inline

Const access to underlying data.

◆ size()

template<typename SetType , typename DataType >
SetPosition axom::slam::DynamicMap< SetType, DataType >::size ( ) const
inline

Returns the size of map's set.

Referenced by axom::slam::DynamicMap< SetType, DataType >::operator[]().

◆ numberOfValidEntries()

template<typename SetType , typename DataType >
SetPosition axom::slam::DynamicMap< SetType, DataType >::numberOfValidEntries ( ) const
inline

Return the number of valid entries.

An entry at a given index is considered valid if corresponding set element is valid.

◆ isValidEntry()

template<typename SetType , typename DataType >
bool axom::slam::DynamicMap< SetType, DataType >::isValidEntry ( SetPosition  pos) const
inline

◆ isValid()

template<typename SetType , typename DataType >
bool axom::slam::DynamicMap< SetType, DataType >::isValid ( bool  verboseOutput = false) const

Predicate to check if this DynamicMap instance is valid.

References SLIC_DEBUG.

Referenced by axom::slam::DynamicMap< SetType, DataType >::isValidEntry().

◆ operator[]() [2/2]

template<typename SetType , typename DataType >
DataType& axom::slam::DynamicMap< SetType, DataType >::operator[] ( SetPosition  position)
inline

Get the value at position position.

Note
Increases the map size if position is out of range

References axom::slam::DynamicMap< SetType, DataType >::resize(), and axom::slam::DynamicMap< SetType, DataType >::size().

◆ insert()

template<typename SetType , typename DataType >
void axom::slam::DynamicMap< SetType, DataType >::insert ( SetPosition  position,
DataType  value 
)
inline

Insert vale value into position position in the map.

Note
Increases the map size if position is out of range

References axom::slam::DynamicMap< SetType, DataType >::operator[]().

◆ resize()

template<typename SetType , typename DataType >
void axom::slam::DynamicMap< SetType, DataType >::resize ( SetPosition  s)
inline

Resizes the map to have at least s positions.

Parameters
sThe minimum necessary capacity for resizing
Precondition
s >= 0

References SLIC_ASSERT_MSG.

Referenced by axom::slam::DynamicMap< SetType, DataType >::operator[]().


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