KeyValueVector< KeyT, ValT, KeyContT, ValContT, IdxT, MapT > Class Template Reference

This class is pretty much similar to a map. More...

#include <ArmarXCore/util/CPPUtility/KeyValueVector.h>

Public Types

using const_iterator = typename ValContT::const_iterator
 
using iterator = typename ValContT::iterator
 

Public Member Functions

void add (KeyT key, ValT value)
 
ValT & at (const KeyT &k)
 
ValT const & at (const KeyT &k) const
 
ValT const & at (const KeyT &k, const ValT &defaultVal) const
 
ValT & at (const KeyT &k, ValT &defaultVal)
 
ValT & at (IdxT i)
 
ValT const & at (IdxT i) const
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
void clear ()
 
IdxT count (const KeyT &k) const
 
iterator end ()
 
const_iterator end () const
 
bool has (const KeyT &k) const
 
IdxT index (const KeyT &k) const
 
MapT const & indices () const
 
KeyContT const & keys () const
 
IdxT size () const
 
ValContT const & values () const
 

Detailed Description

template<class KeyT, class ValT, class KeyContT = std::vector<KeyT>, class ValContT = std::vector<ValT>, class IdxT = typename ValContT::size_type, class MapT = std::map<KeyT, IdxT>>
class armarx::KeyValueVector< KeyT, ValT, KeyContT, ValContT, IdxT, MapT >

This class is pretty much similar to a map.

This class stores keys and values in two vectors and uses a map to map the keys to the index of the corresponding value This enables map acces and index access. The index of an inserted element never changes (this is different to a map). Index access may be required in a high frequency case (e.g. an rt control loop)

Definition at line 45 of file KeyValueVector.h.

Member Typedef Documentation

◆ const_iterator

using const_iterator = typename ValContT::const_iterator

Definition at line 67 of file KeyValueVector.h.

◆ iterator

using iterator = typename ValContT::iterator

Definition at line 66 of file KeyValueVector.h.

Member Function Documentation

◆ add()

void add ( KeyT  key,
ValT  value 
)

Definition at line 95 of file KeyValueVector.h.

+ Here is the caller graph for this function:

◆ at() [1/6]

ValT & at ( const KeyT &  k)

Definition at line 129 of file KeyValueVector.h.

◆ at() [2/6]

const ValT & at ( const KeyT &  k) const

Definition at line 136 of file KeyValueVector.h.

◆ at() [3/6]

const ValT & at ( const KeyT &  k,
const ValT &  defaultVal 
) const

Definition at line 150 of file KeyValueVector.h.

◆ at() [4/6]

ValT & at ( const KeyT &  k,
ValT &  defaultVal 
)

Definition at line 143 of file KeyValueVector.h.

◆ at() [5/6]

ValT & at ( IdxT  i)

Definition at line 115 of file KeyValueVector.h.

+ Here is the caller graph for this function:

◆ at() [6/6]

const ValT & at ( IdxT  i) const

Definition at line 122 of file KeyValueVector.h.

◆ begin() [1/2]

KeyValueVector< KeyT, ValT, KeyContT, ValContT, IdxT, MapT >::const_iterator begin

Definition at line 209 of file KeyValueVector.h.

◆ begin() [2/2]

const_iterator begin ( ) const

◆ cbegin()

KeyValueVector< KeyT, ValT, KeyContT, ValContT, IdxT, MapT >::const_iterator cbegin

Definition at line 237 of file KeyValueVector.h.

◆ cend()

KeyValueVector< KeyT, ValT, KeyContT, ValContT, IdxT, MapT >::const_iterator cend

Definition at line 244 of file KeyValueVector.h.

◆ clear()

void clear

Definition at line 200 of file KeyValueVector.h.

◆ count()

IdxT count ( const KeyT &  k) const

Definition at line 186 of file KeyValueVector.h.

◆ end() [1/2]

KeyValueVector< KeyT, ValT, KeyContT, ValContT, IdxT, MapT >::const_iterator end

Definition at line 216 of file KeyValueVector.h.

◆ end() [2/2]

const_iterator end ( ) const

◆ has()

bool has ( const KeyT &  k) const

Definition at line 193 of file KeyValueVector.h.

+ Here is the caller graph for this function:

◆ index()

IdxT index ( const KeyT &  k) const

Definition at line 108 of file KeyValueVector.h.

+ Here is the caller graph for this function:

◆ indices()

const MapT & indices

Definition at line 172 of file KeyValueVector.h.

◆ keys()

const KeyContT & keys

Definition at line 179 of file KeyValueVector.h.

+ Here is the caller graph for this function:

◆ size()

IdxT size

Definition at line 158 of file KeyValueVector.h.

+ Here is the caller graph for this function:

◆ values()

const ValContT & values

Definition at line 165 of file KeyValueVector.h.

+ Here is the caller graph for this function:

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