preCICE v3.1.2
|
Class handling multiple locks allowing global lock and unlock operations. More...
#include <MultiLock.hpp>
Public Types | |
using | key_type = Key |
The type of the key. | |
using | size_type = std::size_t |
The size type. | |
Public Member Functions | |
void | add (Key name, bool state) |
Adds a lock with a given state. | |
template<typename K > | |
void | lock (const K &name) |
Locks a given lock. | |
void | lockAll () noexcept |
Locks all known locks. | |
template<typename K > | |
void | unlock (const K &name) |
Unlocks a given lock. | |
void | unlockAll () noexcept |
Unlocks all known locks. | |
void | clear () noexcept |
Removes all known locks. | |
template<typename K > | |
bool | check (const K &name) const |
Checks the status of a lock. | |
bool | checkAll () const noexcept |
Checks whether all locks are locked. | |
template<typename K > | |
bool | contains (const K &name) const noexcept |
Checks whether a lock is known. | |
size_type | size () const noexcept |
Returns the total count of locks. | |
size_t | countLocked () const |
Returns the count of locked locks. | |
size_t | countUnlocked () const |
Returns the count of unlocked locks. | |
Private Types | |
using | map_type = typename std::map<Key, bool, std::less<>> |
Private Attributes | |
map_type | _locks |
The map that keeps track of the locks and their state. | |
Class handling multiple locks allowing global lock and unlock operations.
Definition at line 27 of file MultiLock.hpp.
using precice::utils::MultiLock< Key >::key_type = Key |
The type of the key.
Definition at line 30 of file MultiLock.hpp.
|
private |
Definition at line 156 of file MultiLock.hpp.
using precice::utils::MultiLock< Key >::size_type = std::size_t |
The size type.
Definition at line 33 of file MultiLock.hpp.
|
inline |
Adds a lock with a given state.
Adding an already existent lock does nothing.
[in] | name | the name of the lock |
[in] | state | the initial state of the lock |
Definition at line 42 of file MultiLock.hpp.
|
inline |
Checks the status of a lock.
[in] | name | the name of the lock to check |
Definition at line 106 of file MultiLock.hpp.
|
inlinenoexcept |
Checks whether all locks are locked.
Definition at line 117 of file MultiLock.hpp.
|
inlinenoexcept |
Removes all known locks.
Definition at line 94 of file MultiLock.hpp.
|
inlinenoexcept |
Checks whether a lock is known.
[in] | name | the name to check |
Definition at line 132 of file MultiLock.hpp.
|
inline |
Returns the count of locked locks.
Definition at line 144 of file MultiLock.hpp.
|
inline |
Returns the count of unlocked locks.
Definition at line 150 of file MultiLock.hpp.
|
inline |
Locks a given lock.
[in] | name | the name of to lock |
Definition at line 52 of file MultiLock.hpp.
|
inlinenoexcept |
Locks all known locks.
Definition at line 63 of file MultiLock.hpp.
|
inlinenoexcept |
Returns the total count of locks.
Definition at line 138 of file MultiLock.hpp.
|
inline |
Unlocks a given lock.
[in] | name | the name of to unlock |
Definition at line 75 of file MultiLock.hpp.
|
inlinenoexcept |
Unlocks all known locks.
Definition at line 86 of file MultiLock.hpp.
|
private |
The map that keeps track of the locks and their state.
Definition at line 159 of file MultiLock.hpp.