18 #ifndef LUNCHBOX_LOCKABLE_H 19 #define LUNCHBOX_LOCKABLE_H 22 #include <boost/noncopyable.hpp> 32 template<
class D,
class L = Lock >
class Lockable :
public boost::noncopyable
39 explicit Lockable(
const D& value ) : data( value ) {}
42 template<
class P1 >
Lockable(
const P1& p1 ) : data( p1 ) {}
57 bool operator == (
const D& rhs )
const {
return ( data == rhs ); }
67 template<
class D,
class L >
68 inline std::ostream& operator << ( std::ostream& os, const Lockable<D, L>& l )
70 return os <<
disableFlush <<
"<" << l.lock.isSet() <<
" " << l.data <<
">" 74 #endif // LUNCHBOX_LOCKABLE_H std::ostream & enableFlush(std::ostream &os)
Re-enable flushing of the Log stream.
D * operator->()
Access the held data.
Lockable & operator=(const D &rhs)
Assign another value to the data.
Lockable(const D &value)
Construct and initialize a new data structure.
const D * operator->() const
Access the held data.
A convenience structure to hold data together with a lock for access.
Lockable(const P1 &p1)
Construct and initialize a new data structure.
const D & operator*() const
Access the held data.
Abstraction layer and common utilities for multi-threaded programming.
D & operator*()
Access the held data.
This file contains logging classes.
Lockable()
Construct a new lockable data structure.
std::ostream & disableFlush(std::ostream &os)
Disable flushing of the Log stream.
bool operator==(const D &rhs) const