GEOSX
Public Types | Public Member Functions | Static Public Attributes | List of all members
KeyIndexT< KEY_TYPE, INDEX_TYPE, INVALID_INDEX > Class Template Reference

#include <KeyIndexT.hpp>

Public Types

using key_type = KEY_TYPE
 the type used for the map key
 
using index_type = INDEX_TYPE
 the type used for the index
 

Public Member Functions

 KeyIndexT ()=delete
 Deleted default constructor.
 
 KeyIndexT (KEY_TYPE const &key)
 Constructor that sets the key. More...
 
 KeyIndexT (KeyIndexT const &)=default
 Copy constructor.
 
KeyIndexToperator= (KeyIndexT const &)=default
 Copy assignment operator. More...
 
 KeyIndexT (KeyIndexT &&)=default
 Move constructor.
 
KeyIndexToperator= (KeyIndexT &&)=default
 Move assignment operator. More...
 
bool operator== (KEY_TYPE const &key) const
 Comparison equals operator. More...
 
virtual ~KeyIndexT ()
 Destructor.
 
KEY_TYPE const & Key () const
 Access for the key. More...
 
INDEX_TYPE const & Index () const
 Access for the index. More...
 
bool isIndexSet () const
 Check to see of the index has been set. More...
 
void setIndex (INDEX_TYPE const &index) const
 Set the index. More...
 

Static Public Attributes

static constexpr INDEX_TYPE invalid_index = INVALID_INDEX
 the value of an invalid index
 

Detailed Description

template<typename KEY_TYPE = std::string, typename INDEX_TYPE = int, int INVALID_INDEX = -1>
class KeyIndexT< KEY_TYPE, INDEX_TYPE, INVALID_INDEX >

Template Parameters
KEY_TYPEthe key type
INDEX_TYPEthe index type
INVALID_INDEXthe value of an unset/invalid index

This class is used for fast index based lookups for a MappedVector type. It is templated on a contains a KEY_TYPE, which is defaulted to a string, an INDEX_TYPE that defaults to an int. The key is const, while the index is set upon first use. The intent is to use the index for lookups, and check the key to confirm the key is correct.

Definition at line 40 of file KeyIndexT.hpp.

Constructor & Destructor Documentation

◆ KeyIndexT()

template<typename KEY_TYPE = std::string, typename INDEX_TYPE = int, int INVALID_INDEX = -1>
KeyIndexT< KEY_TYPE, INDEX_TYPE, INVALID_INDEX >::KeyIndexT ( KEY_TYPE const &  key)
inline

Constructor that sets the key.

Parameters
[in]keythe key that defines the KeyIndex

Definition at line 61 of file KeyIndexT.hpp.

Member Function Documentation

◆ Index()

template<typename KEY_TYPE = std::string, typename INDEX_TYPE = int, int INVALID_INDEX = -1>
INDEX_TYPE const& KeyIndexT< KEY_TYPE, INDEX_TYPE, INVALID_INDEX >::Index ( ) const
inline

Access for the index.

Returns
a const reference to the index

Definition at line 112 of file KeyIndexT.hpp.

◆ isIndexSet()

template<typename KEY_TYPE = std::string, typename INDEX_TYPE = int, int INVALID_INDEX = -1>
bool KeyIndexT< KEY_TYPE, INDEX_TYPE, INVALID_INDEX >::isIndexSet ( ) const
inline

Check to see of the index has been set.

Returns
true if the index has been set

Definition at line 119 of file KeyIndexT.hpp.

◆ Key()

template<typename KEY_TYPE = std::string, typename INDEX_TYPE = int, int INVALID_INDEX = -1>
KEY_TYPE const& KeyIndexT< KEY_TYPE, INDEX_TYPE, INVALID_INDEX >::Key ( ) const
inline

Access for the key.

Returns
a const reference of the key

Definition at line 105 of file KeyIndexT.hpp.

◆ operator=() [1/2]

template<typename KEY_TYPE = std::string, typename INDEX_TYPE = int, int INVALID_INDEX = -1>
KeyIndexT& KeyIndexT< KEY_TYPE, INDEX_TYPE, INVALID_INDEX >::operator= ( KeyIndexT< KEY_TYPE, INDEX_TYPE, INVALID_INDEX > const &  )
default

Copy assignment operator.

Returns
reference to this object

◆ operator=() [2/2]

template<typename KEY_TYPE = std::string, typename INDEX_TYPE = int, int INVALID_INDEX = -1>
KeyIndexT& KeyIndexT< KEY_TYPE, INDEX_TYPE, INVALID_INDEX >::operator= ( KeyIndexT< KEY_TYPE, INDEX_TYPE, INVALID_INDEX > &&  )
default

Move assignment operator.

Returns
reference to this object

◆ operator==()

template<typename KEY_TYPE = std::string, typename INDEX_TYPE = int, int INVALID_INDEX = -1>
bool KeyIndexT< KEY_TYPE, INDEX_TYPE, INVALID_INDEX >::operator== ( KEY_TYPE const &  key) const
inline

Comparison equals operator.

Parameters
keythe key to compare
Returns
true if m_key==key

Definition at line 93 of file KeyIndexT.hpp.

◆ setIndex()

template<typename KEY_TYPE = std::string, typename INDEX_TYPE = int, int INVALID_INDEX = -1>
void KeyIndexT< KEY_TYPE, INDEX_TYPE, INVALID_INDEX >::setIndex ( INDEX_TYPE const &  index) const
inline

Set the index.

Parameters
[in]indexnew value of the index

Definition at line 128 of file KeyIndexT.hpp.


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