LogCabin
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Attributes
LogCabin::Client::SessionManager::LockedAssignment< T > Class Template Reference

Gets and sets a value while holding a mutex. More...

#include <SessionManager.h>

List of all members.

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.
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
value

Detailed Description

template<typename T>
class LogCabin::Client::SessionManager::LockedAssignment< T >

Gets and sets a value while holding a mutex.

Definition at line 59 of file SessionManager.h.


Constructor & Destructor Documentation

template<typename T >
LogCabin::Client::SessionManager::LockedAssignment< T >::LockedAssignment ( ) [inline]

Default constructor: empty.

Definition at line 64 of file SessionManager.h.

template<typename T >
LogCabin::Client::SessionManager::LockedAssignment< T >::LockedAssignment ( value) [inline, explicit]

Constructor that initializes this object with the given value.

Definition at line 74 of file SessionManager.h.


Member Function Documentation

template<typename T >
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.

template<typename T >
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.

template<typename T >
void LogCabin::Client::SessionManager::LockedAssignment< T >::clear ( ) [inline]

Clears out the value, if any.

Definition at line 108 of file SessionManager.h.

template<typename T >
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.


Member Data Documentation

template<typename T >
std::mutex LogCabin::Client::SessionManager::LockedAssignment< T >::mutex [mutable, private]

Definition at line 124 of file SessionManager.h.

template<typename T >
bool LogCabin::Client::SessionManager::LockedAssignment< T >::empty [private]

Definition at line 125 of file SessionManager.h.

template<typename T >
T LogCabin::Client::SessionManager::LockedAssignment< T >::value [private]

Definition at line 126 of file SessionManager.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines