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
D * operator->()
Access the held data.
Lockable & operator=(const D &rhs)
Assign another value to the data.
LUNCHBOX_API std::ostream & enableFlush(std::ostream &os)
Re-enable flushing of the Log stream.
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.
D & operator*()
Access the held data.
LUNCHBOX_API std::ostream & disableFlush(std::ostream &os)
Disable flushing of the Log stream.
This file contains logging classes.
Lockable()
Construct a new lockable data structure.
bool operator==(const D &rhs) const