LogCabin
|
Gets and sets a value while holding a mutex. More...
#include <SessionManager.h>
Public Member Functions | |
LockedAssignment () | |
Default constructor: empty. | |
LockedAssignment (T value) | |
Constructor that initializes this object with the given value. | |
std::pair< bool, T > | get () const |
Returns true and the value if there is one, or false and a default constructed value otherwise. | |
T | getOrDefault () const |
Returns the value if there is one, or a default constructed value otherwise. | |
void | clear () |
Clears out the value, if any. | |
void | set (const T &newValue) |
Overwrites the value with the given one. | |
Private Attributes | |
std::mutex | mutex |
bool | empty |
T | value |
Gets and sets a value while holding a mutex.
Definition at line 59 of file SessionManager.h.
LogCabin::Client::SessionManager::LockedAssignment< T >::LockedAssignment | ( | ) | [inline] |
Default constructor: empty.
Definition at line 64 of file SessionManager.h.
LogCabin::Client::SessionManager::LockedAssignment< T >::LockedAssignment | ( | T | value | ) | [inline, explicit] |
Constructor that initializes this object with the given value.
Definition at line 74 of file SessionManager.h.
std::pair<bool, T> LogCabin::Client::SessionManager::LockedAssignment< T >::get | ( | ) | const [inline] |
Returns true and the value if there is one, or false and a default constructed value otherwise.
Definition at line 85 of file SessionManager.h.
T LogCabin::Client::SessionManager::LockedAssignment< T >::getOrDefault | ( | ) | const [inline] |
Returns the value if there is one, or a default constructed value otherwise.
Definition at line 97 of file SessionManager.h.
void LogCabin::Client::SessionManager::LockedAssignment< T >::clear | ( | ) | [inline] |
Clears out the value, if any.
Definition at line 108 of file SessionManager.h.
void LogCabin::Client::SessionManager::LockedAssignment< T >::set | ( | const T & | newValue | ) | [inline] |
Overwrites the value with the given one.
Definition at line 117 of file SessionManager.h.
std::mutex LogCabin::Client::SessionManager::LockedAssignment< T >::mutex [mutable, private] |
Definition at line 124 of file SessionManager.h.
bool LogCabin::Client::SessionManager::LockedAssignment< T >::empty [private] |
Definition at line 125 of file SessionManager.h.
T LogCabin::Client::SessionManager::LockedAssignment< T >::value [private] |
Definition at line 126 of file SessionManager.h.