identt
SharedStringSet.hpp
Go to the documentation of this file.
1 
33 #ifndef _IDENTT_UTILS_SHARED_STRING_SET_HPP_
34 #define _IDENTT_UTILS_SHARED_STRING_SET_HPP_
35 
36 #include <utils/SharedObject.hpp>
37 #include <string>
38 #include <set>
39 
40 namespace identt {
41 namespace utils {
42 class SharedStringSet : public SharedObject<std::set<std::string> > {
43 public:
44  using StringSet = std::set<std::string>;
45  using LockT = SharedObject<StringSet>::LockT;
46  using WriteLockT = SharedObject<StringSet>::WriteLockT;
47  using ReadLockT = SharedObject<StringSet>::ReadLockT;
48 
53  SharedStringSet(const SharedStringSet&) = delete;
54  SharedStringSet& operator=(const SharedStringSet&) = delete;
55 
61 
65  virtual ~SharedStringSet () {}
66 
76  void Add(std::string elem)
77  {
78  WriteLockT lock(mutex_);
79  t_.insert(elem);
80  }
81 
88  size_t GetSize()
89  {
90  ReadLockT lock(mutex_);
91  return t_.size();
92  }
93 
100  void Reset()
101  {
102  WriteLockT lock(mutex_);
103  t_.clear();
104  }
105 
106 };
107 } // namespace utils
108 } // namespace identt
109 #endif /* _IDENTT_UTILS_SHARED_STRING_SET_HPP_ */
void Add(std::string elem)
Add : add one value.
Definition: SharedStringSet.hpp:76
virtual ~SharedStringSet()
destructor
Definition: SharedStringSet.hpp:65
Definition: SharedStringSet.hpp:42
Definition: SharedObject.hpp:43
void Reset()
Reset: clear the set.
Definition: SharedStringSet.hpp:100
Definition: CryptoBase.hpp:49
size_t GetSize()
GetSize: get size of set.
Definition: SharedStringSet.hpp:88
SharedStringSet()
Constructor : default.
Definition: SharedStringSet.hpp:60