33 #ifndef _IDENTT_UTILS_SHARED_STRING_MAP_HPP_ 34 #define _IDENTT_UTILS_SHARED_STRING_MAP_HPP_ 38 #include <unordered_map> 45 using StringMapT = std::unordered_map<std::string,T>;
46 using LockT = SharedObject<StringMapT>::LockT;
47 using WriteLockT = SharedObject<StringMapT>::WriteLockT;
48 using ReadLockT = SharedObject<StringMapT>::ReadLockT;
80 void Add(std::string key, T value)
82 WriteLockT writelock(mutex_);
98 void Add(std::string& key, T value)
100 WriteLockT writelock(mutex_);
116 ReadLockT readlock(mutex_);
117 StringMapT::const_iterator it = t_.find(key);
118 return (it!=t_.end()) ? it->second : T() ;
132 ReadLockT readlock(mutex_);
133 StringMapT::const_iterator it = t_.find(key);
134 return (it!=t_.end()) ? it->second : T() ;
virtual ~SharedStringMap()
destructor
Definition: SharedStringMap.hpp:66
void Add(std::string &key, T value)
Add : add one value by address.
Definition: SharedStringMap.hpp:98
T Get(std::string key)
Get : add one value.
Definition: SharedStringMap.hpp:114
Definition: SharedObject.hpp:43
SharedStringMap()
Constructor : default.
Definition: SharedStringMap.hpp:61
Definition: CryptoBase.hpp:49
T Get(std::string &key)
Get : add one value by address.
Definition: SharedStringMap.hpp:130
void Add(std::string key, T value)
Add : add one value.
Definition: SharedStringMap.hpp:80
Definition: SharedStringMap.hpp:43