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

Public Types

using MapT = 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

 SharedMap (const SharedMap &)=delete
 make noncopyable and remove default
 
SharedMapoperator= (const SharedMap &)=delete
 
 SharedMap ()
 Constructor : default. More...
 
virtual ~SharedMap ()
 destructor
 
void AddOne (KeyT key, ValueT value)
 AddOne : add one value. More...
 
void AddMany (const MapT &m)
 AddMany : add from map by address. More...
 
void AddMany (MapT &&m)
 AddMany : add from map by lvalue ref. More...
 
bool GetValues (KeyT &key, ValueT &value)
 GetValues : get values by address. More...
 
bool GetValues (KeyT &&key, ValueT &value)
 GetValues : get values by lvalue ref. More...
 
MapT 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...
 
void Swap (MapT t)
 Swap : get by swap. More...
 

Protected Attributes

MapT t_
 
LockT mutex_
 

Constructor & Destructor Documentation

§ SharedMap()

template<class KeyT, class ValueT>
identt::utils::SharedMap< KeyT, ValueT >::SharedMap ( )
inline

Constructor : default.

Member Function Documentation

§ AddMany() [1/2]

template<class KeyT, class ValueT>
void identt::utils::SharedMap< KeyT, ValueT >::AddMany ( const MapT &  m)
inline

AddMany : add from map by address.

Parameters
mconst Map& map to get from
Returns
none

§ AddMany() [2/2]

template<class KeyT, class ValueT>
void identt::utils::SharedMap< KeyT, ValueT >::AddMany ( MapT &&  m)
inline

AddMany : add from map by lvalue ref.

Parameters
mconst Map&& map to get from
Returns
none

§ AddOne()

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

AddOne : add one value.

Parameters
keyKeyT elem to add
valueValueT elem to add
Returns
none

§ GetCopy()

template<class KeyT, class ValueT>
MapT identt::utils::SharedMap< KeyT, ValueT >::GetCopy ( )
inline

GetCopy : get a copy of the map.

Returns
MapT map

§ GetSize()

template<class KeyT, class ValueT>
size_t identt::utils::SharedMap< KeyT, ValueT >::GetSize ( )
inline

GetSize: get size of set.

Returns
size_t size

§ GetValues() [1/2]

template<class KeyT, class ValueT>
bool identt::utils::SharedMap< KeyT, ValueT >::GetValues ( KeyT &  key,
ValueT &  value 
)
inline

GetValues : get values by address.

Parameters
keyKeyT& elem to get
valueValueT& elem to get
Returns
bool true if exists

§ GetValues() [2/2]

template<class KeyT, class ValueT>
bool identt::utils::SharedMap< KeyT, ValueT >::GetValues ( KeyT &&  key,
ValueT &  value 
)
inline

GetValues : get values by lvalue ref.

Parameters
keyKeyT&& elem to get
valueValueT& elem to get
Returns
bool true if exists

§ Reset()

template<class KeyT, class ValueT>
void identt::utils::SharedMap< KeyT, ValueT >::Reset ( )
inline

Reset: clear the set.

Returns
none

§ Swap()

template<class KeyT, class ValueT>
void identt::utils::SharedMap< KeyT, ValueT >::Swap ( MapT  t)
inline

Swap : get by swap.

Returns
none

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