identt
Public Types | Public Member Functions | Protected Attributes | List of all members
identt::utils::SharedPairMap< KeyT, LeftT, RightT > Class Template Reference

Public Types

using ValueT = std::pair< LeftT, RightT >
 
using PairMapT = std::unordered_map< KeyT, ValueT >
 
using LockT = boost::shared_mutex
 
using WriteLockT = boost::unique_lock< LockT >
 
using ReadLockT = boost::shared_lock< LockT >
 

Public Member Functions

 SharedPairMap (const SharedPairMap &)=delete
 make noncopyable and remove default
 
SharedPairMapoperator= (const SharedPairMap &)=delete
 
 SharedPairMap ()
 Constructor : default. More...
 
virtual ~SharedPairMap ()
 destructor
 
void AddOne (KeyT key, ValueT value)
 AddOne : add one value. More...
 
void AddLeft (KeyT key, LeftT value)
 AddLeft : add one value. More...
 
void AddRight (KeyT key, RightT value)
 AddRight : add one value. More...
 
void Swap (PairMapT m)
 Swap : swap from map. More...
 
void AddMany (const PairMapT &m)
 AddMany : add from map by address. More...
 
void AddMany (PairMapT &&m)
 AddMany : add from map by lvalue ref. More...
 
bool GetValues (KeyT &&key, LeftT &left, RightT &right)
 GetValues : get values. More...
 
bool GetValues (const KeyT &key, LeftT &left, RightT &right)
 GetValues : get values by address. More...
 
PairMapT GetCopy ()
 GetCopy : get a copy of the map. More...
 
size_t GetSize ()
 GetSize: get size of set. More...
 
void Reset ()
 Reset: clear the set. More...
 

Protected Attributes

PairMapT t_
 
LockT mutex_
 

Constructor & Destructor Documentation

§ SharedPairMap()

template<class KeyT, class LeftT, class RightT>
identt::utils::SharedPairMap< KeyT, LeftT, RightT >::SharedPairMap ( )
inline

Constructor : default.

Member Function Documentation

§ AddLeft()

template<class KeyT, class LeftT, class RightT>
void identt::utils::SharedPairMap< KeyT, LeftT, RightT >::AddLeft ( KeyT  key,
LeftT  value 
)
inline

AddLeft : add one value.

Parameters
keyKeyT elem to add
valueValueT elem to add
Returns
none

§ AddMany() [1/2]

template<class KeyT, class LeftT, class RightT>
void identt::utils::SharedPairMap< KeyT, LeftT, RightT >::AddMany ( const PairMapT &  m)
inline

AddMany : add from map by address.

Parameters
mconst PairMap& map to get from
Returns
none

§ AddMany() [2/2]

template<class KeyT, class LeftT, class RightT>
void identt::utils::SharedPairMap< KeyT, LeftT, RightT >::AddMany ( PairMapT &&  m)
inline

AddMany : add from map by lvalue ref.

Parameters
mconst PairMap&& map to get from
Returns
none

§ AddOne()

template<class KeyT, class LeftT, class RightT>
void identt::utils::SharedPairMap< KeyT, LeftT, RightT >::AddOne ( KeyT  key,
ValueT  value 
)
inline

AddOne : add one value.

Parameters
keyKeyT elem to add
valueValueT elem to add
Returns
none

§ AddRight()

template<class KeyT, class LeftT, class RightT>
void identt::utils::SharedPairMap< KeyT, LeftT, RightT >::AddRight ( KeyT  key,
RightT  value 
)
inline

AddRight : add one value.

Parameters
keyKeyT elem to add
valueValueT elem to add
Returns
none

§ GetCopy()

template<class KeyT, class LeftT, class RightT>
PairMapT identt::utils::SharedPairMap< KeyT, LeftT, RightT >::GetCopy ( )
inline

GetCopy : get a copy of the map.

Returns
PairMapT map

§ GetSize()

template<class KeyT, class LeftT, class RightT>
size_t identt::utils::SharedPairMap< KeyT, LeftT, RightT >::GetSize ( )
inline

GetSize: get size of set.

Returns
size_t size

§ GetValues() [1/2]

template<class KeyT, class LeftT, class RightT>
bool identt::utils::SharedPairMap< KeyT, LeftT, RightT >::GetValues ( KeyT &&  key,
LeftT &  left,
RightT &  right 
)
inline

GetValues : get values.

Parameters
keyKeyT&& elem to get
leftLeftT& elem to get
rightRightT& elem to get
Returns
bool true if exists

§ GetValues() [2/2]

template<class KeyT, class LeftT, class RightT>
bool identt::utils::SharedPairMap< KeyT, LeftT, RightT >::GetValues ( const KeyT &  key,
LeftT &  left,
RightT &  right 
)
inline

GetValues : get values by address.

Parameters
keyKeyT& elem to get by address
leftLeftT& elem to get
rightRightT& elem to get
Returns
bool true if exists

§ Reset()

template<class KeyT, class LeftT, class RightT>
void identt::utils::SharedPairMap< KeyT, LeftT, RightT >::Reset ( )
inline

Reset: clear the set.

Returns
none

§ Swap()

template<class KeyT, class LeftT, class RightT>
void identt::utils::SharedPairMap< KeyT, LeftT, RightT >::Swap ( PairMapT  m)
inline

Swap : swap from map.

Parameters
mPairMap map to swap
Returns
none

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