19 const char *
what() const noexcept
override
21 return "The multilock does not contain the requested lock!";
26template <
typename Key>
55 if (iter ==
_locks.end()) {
78 if (iter ==
_locks.end()) {
105 template <
typename K>
109 if (iter ==
_locks.end()) {
119 using KL =
typename decltype(
_locks)::value_type;
131 template <
typename K>
152 return std::count_if(
_locks.begin(),
_locks.end(), [](
typename map_type::value_type
const &kv) { return not kv.second; });
const char * what() const noexcept override
Class handling multiple locks allowing global lock and unlock operations.
size_t countLocked() const
Returns the count of locked locks.
bool check(const K &name) const
Checks the status of a lock.
Key key_type
The type of the key.
size_t countUnlocked() const
Returns the count of unlocked locks.
void add(Key name, bool state)
Adds a lock with a given state.
void lock(const K &name)
Locks a given lock.
void clear() noexcept
Removes all known locks.
void lockAll() noexcept
Locks all known locks.
void unlockAll() noexcept
Unlocks all known locks.
bool checkAll() const noexcept
Checks whether all locks are locked.
typename std::map< Key, bool, std::less<> > map_type
size_type size() const noexcept
Returns the total count of locks.
map_type _locks
The map that keeps track of the locks and their state.
bool contains(const K &name) const noexcept
Checks whether a lock is known.
void unlock(const K &name)
Unlocks a given lock.
Main namespace of the precice library.