18 const char *
what() const noexcept
override
20 return "The multilock does not contain the requested lock!";
18 const char *
what() const noexcept
override {
…}
25template <
typename Key>
54 if (iter ==
_locks.end()) {
77 if (iter ==
_locks.end()) {
104 template <
typename K>
108 if (iter ==
_locks.end()) {
118 using KL =
typename decltype(
_locks)::value_type;
130 template <
typename K>
151 return std::count_if(
_locks.begin(),
_locks.end(), [](
typename map_type::value_type
const &kv) { return not kv.second; });
LockNotFoundException()=default
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.
contains precice-related utilities.