Lunchbox  1.15.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 = Lock>
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 32 of file lockable.h.

Constructor & Destructor Documentation

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

Construct a new lockable data structure.

Version
1.0

Definition at line 36 of file lockable.h.

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

Construct and initialize a new data structure.

Version
1.0

Definition at line 39 of file lockable.h.

template<class D, class L = Lock>
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 42 of file lockable.h.

Member Function Documentation

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

Access the held data.

Version
1.1.5

Definition at line 51 of file lockable.h.

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

Access the held data.

Version
1.1.5

Definition at line 54 of file lockable.h.

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

Access the held data.

Version
1.0

Definition at line 45 of file lockable.h.

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

Access the held data.

Version
1.0

Definition at line 48 of file lockable.h.

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

Assign another value to the data.

Version
1.0

Definition at line 60 of file lockable.h.

template<class D, class L = Lock>
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 57 of file lockable.h.


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