1 #ifndef FWCore_Utilities_ThreadSafeRegistry_h 2 #define FWCore_Utilities_ThreadSafeRegistry_h 29 #pragma GCC visibility push(default) 33 template <
typename KEY,
typename T>
55 value_type
const*
getMapped(key_type
const&
k)
const;
78 size_type
size()
const;
81 void print(std::ostream& os)
const;
96 template <
typename KEY,
typename T,
typename E>
97 inline std::ostream& operator<<(std::ostream& os, ThreadSafeRegistry<KEY, T>
const& reg) {
102 template <
typename KEY,
typename T>
104 for (
auto const&
item : c) {
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";
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
static boost::mutex mutex
size_type size() const
Return the number of contained value_type objects.
bool empty() const
Return true if there are no contained value_type objects.
std::map< key_type, value_type > collection_type
collection_type::size_type size_type
bool insertMapped(value_type const &v)
std::vector< value_type > vector_type
static ThreadSafeRegistry * instance()
bool getMapped(key_type const &k, value_type &result) const
void insertCollection(collection_type const &c)
void print(std::ostream &os) const
Print the contents of this registry to the given ostream.
bool notEmpty() const
Return true if there are any contained value_type objects.
ThreadSafeRegistry< KEY, T > & operator=(ThreadSafeRegistry< KEY, T > const &)=delete