|
|
Go to the documentation of this file. 1 #ifndef FWCore_Utilities_ThreadSafeRegistry_h
2 #define FWCore_Utilities_ThreadSafeRegistry_h
29 #pragma GCC visibility push(default)
33 template <
typename KEY,
typename T>
81 void print(std::ostream& os)
const;
96 template <
typename KEY,
typename T,
typename E>
102 template <
typename KEY,
typename T>
104 for (
auto const&
item :
c) {
105 insertMapped(
item.second);
109 template <
typename KEY,
typename T>
111 for (
auto const&
item :
c) {
116 template <
typename KEY,
typename T>
118 std::lock_guard<std::mutex> guard(mutex_);
119 return data_.empty();
122 template <
typename KEY,
typename T>
127 template <
typename KEY,
typename T>
129 std::lock_guard<std::mutex> guard(mutex_);
133 template <
typename KEY,
typename T>
135 std::lock_guard<std::mutex> guard(mutex_);
136 os <<
"Registry with " <<
size() <<
" entries\n";
137 for (
auto const&
item : data_) {
138 os <<
item.first <<
" " <<
item.second <<
'\n';
142 template <
typename KEY,
typename T>
145 template <
typename KEY,
typename T>
150 #pragma GCC visibility pop
151 #endif // FWCore_Utilities_ThreadSafeRegistry_h
collection_type::size_type size_type
bool empty() const
Return true if there are no contained value_type objects.
bool insertMapped(value_type const &v)
size_type size() const
Return the number of contained value_type objects.
std::vector< value_type > vector_type
std::map< key_type, value_type > collection_type
bool getMapped(key_type const &k, value_type &result) const
static ThreadSafeRegistry * instance()
void print(std::ostream &os) const
Print the contents of this registry to the given ostream.
static boost::mutex mutex
void insertCollection(collection_type const &c)
bool notEmpty() const
Return true if there are any contained value_type objects.
ThreadSafeRegistry< KEY, T > & operator=(ThreadSafeRegistry< KEY, T > const &)=delete
std::ostream & operator<<(std::ostream &os, ThreadSafeRegistry< KEY, T > const ®)