Lunchbox  1.17.0
Multi-threaded C++ toolbox library for all application developers creating high-performance multi-threaded programs.
lunchbox::Lockable< D, L > Class Template Reference

A convenience structure to hold data together with a lock for access. More...

#include <lockable.h>

+ Inheritance diagram for lunchbox::Lockable< D, L >:
+ Collaboration diagram for lunchbox::Lockable< D, L >:

Public Member Functions

 Lockable ()
 Construct a new lockable data structure. More...
 
 Lockable (const D &value)
 Construct and initialize a new data structure. More...
 
template<class P1 >
 Lockable (const P1 &p1)
 Construct and initialize a new data structure. More...
 
D * operator-> ()
 Access the held data. More...
 
const D * operator-> () const
 Access the held data. More...
 
D & operator* ()
 Access the held data. More...
 
const D & operator* () const
 Access the held data. More...
 
bool operator== (const D &rhs) const
 
Lockableoperator= (const D &rhs)
 Assign another value to the data. More...
 

Public Attributes

data
 
lock
 

Detailed Description

template<class D, class L = std::mutex>
class lunchbox::Lockable< D, L >

A convenience structure to hold data together with a lock for access.

Locking the data still has to be done manually, e.g, using a ScopedMutex.

Definition at line 35 of file lockable.h.

Constructor & Destructor Documentation

template<class D, class L = std::mutex>
lunchbox::Lockable< D, L >::Lockable ( )
inline

Construct a new lockable data structure.

Version
1.0

Definition at line 39 of file lockable.h.

template<class D, class L = std::mutex>
lunchbox::Lockable< D, L >::Lockable ( const D &  value)
inlineexplicit

Construct and initialize a new data structure.

Version
1.0

Definition at line 41 of file lockable.h.

template<class D, class L = std::mutex>
template<class P1 >
lunchbox::Lockable< D, L >::Lockable ( const P1 &  p1)
inline

Construct and initialize a new data structure.

Version
1.3.2

Definition at line 48 of file lockable.h.

Member Function Documentation

template<class D, class L = std::mutex>
D& lunchbox::Lockable< D, L >::operator* ( )
inline

Access the held data.

Version
1.1.5

Definition at line 58 of file lockable.h.

template<class D, class L = std::mutex>
const D& lunchbox::Lockable< D, L >::operator* ( ) const
inline

Access the held data.

Version
1.1.5

Definition at line 60 of file lockable.h.

template<class D, class L = std::mutex>
D* lunchbox::Lockable< D, L >::operator-> ( )
inline

Access the held data.

Version
1.0

Definition at line 54 of file lockable.h.

template<class D, class L = std::mutex>
const D* lunchbox::Lockable< D, L >::operator-> ( ) const
inline

Access the held data.

Version
1.0

Definition at line 56 of file lockable.h.

template<class D, class L = std::mutex>
Lockable& lunchbox::Lockable< D, L >::operator= ( const D &  rhs)
inline

Assign another value to the data.

Version
1.0

Definition at line 64 of file lockable.h.

template<class D, class L = std::mutex>
bool lunchbox::Lockable< D, L >::operator== ( const D &  rhs) const
inline
Returns
true if the data is equal to the rhs object.
Version
1.0

Definition at line 62 of file lockable.h.


The documentation for this class was generated from the following file: