Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::externally_locked< T &, MutexType > Class Template Reference

externally_locked<T&,M> specialization for T& that cloaks an reference to an object of type T, and actually provides full access to that object through the get and set member functions, provided you pass a reference to a strict lock object. More...

#include <externally_locked.hpp>

Public Types

typedef MutexType mutex_type
 

Public Member Functions

 externally_locked (T &obj, mutex_type &mtx) BOOST_NOEXCEPT
 Effects: Constructs an externally locked object storing the cloaked reference object. More...
 
 externally_locked (externally_locked const &rhs) BOOST_NOEXCEPT
 copy constructor More...
 
 externally_locked (BOOST_THREAD_RV_REF(externally_locked) rhs) BOOST_NOEXCEPT
 move constructor More...
 
externally_lockedoperator= (externally_locked const &rhs) BOOST_NOEXCEPT
 assignment More...
 
externally_lockedoperator= (BOOST_THREAD_RV_REF(externally_locked) rhs) BOOST_NOEXCEPT
 move assignment More...
 
void swap (externally_locked &rhs) BOOST_NOEXCEPT
 
Tget (strict_lock< mutex_type > const &lk)
 Requires: The lk parameter must be locking the associated mtx. More...
 
const Tget (strict_lock< mutex_type > const &lk) const
 
template<class Lock >
Tget (nested_strict_lock< Lock > const &lk)
 
template<class Lock >
const Tget (nested_strict_lock< Lock > const &lk) const
 
template<class Lock >
Tget (Lock const &lk)
 Requires: The lk parameter must be locking the associated mtx. More...
 
template<class Lock >
T const & get (Lock const &lk) const
 Requires: The lk parameter must be locking the associated mtx. More...
 
mutex_typemutex () const BOOST_NOEXCEPT
 
void lock ()
 
void unlock ()
 
bool try_lock ()
 

Protected Attributes

Tobj_
 
mutex_typemtx_
 

Detailed Description

template<typename T, typename MutexType>
class boost::externally_locked< T &, MutexType >

externally_locked<T&,M> specialization for T& that cloaks an reference to an object of type T, and actually provides full access to that object through the get and set member functions, provided you pass a reference to a strict lock object.

Member Typedef Documentation

template<typename T , typename MutexType >
typedef MutexType boost::externally_locked< T &, MutexType >::mutex_type

Constructor & Destructor Documentation

template<typename T , typename MutexType >
boost::externally_locked< T &, MutexType >::externally_locked ( T obj,
mutex_type mtx 
)
inline

Effects: Constructs an externally locked object storing the cloaked reference object.

template<typename T , typename MutexType >
boost::externally_locked< T &, MutexType >::externally_locked ( externally_locked< T &, MutexType > const &  rhs)
inline

copy constructor

template<typename T , typename MutexType >
boost::externally_locked< T &, MutexType >::externally_locked ( BOOST_THREAD_RV_REF(externally_locked< T &, MutexType >)  rhs)
inline

move constructor

Member Function Documentation

template<typename T , typename MutexType >
T& boost::externally_locked< T &, MutexType >::get ( strict_lock< mutex_type > const &  lk)
inline

Requires: The lk parameter must be locking the associated mtx.

Returns: The address of the cloaked object..

Throws: lock_error if BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED is not defined and the lk parameter doesn't satisfy the preconditions

References boost::interprocess::lock_error.

template<typename T , typename MutexType >
const T& boost::externally_locked< T &, MutexType >::get ( strict_lock< mutex_type > const &  lk) const
inline
template<typename T , typename MutexType >
template<class Lock >
T& boost::externally_locked< T &, MutexType >::get ( nested_strict_lock< Lock > const &  lk)
inline
template<typename T , typename MutexType >
template<class Lock >
const T& boost::externally_locked< T &, MutexType >::get ( nested_strict_lock< Lock > const &  lk) const
inline
template<typename T , typename MutexType >
template<class Lock >
T& boost::externally_locked< T &, MutexType >::get ( Lock const &  lk)
inline

Requires: The lk parameter must be locking the associated mtx.

Returns: The address of the cloaked object..

Throws: lock_error if BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED is not defined and the lk parameter doesn't satisfy the preconditions

References boost::BOOST_CONCEPT_ASSERT(), boost::BOOST_STATIC_ASSERT(), boost::interprocess::lock_error, and boost::program_options::value().

template<typename T , typename MutexType >
template<class Lock >
T const& boost::externally_locked< T &, MutexType >::get ( Lock const &  lk) const
inline

Requires: The lk parameter must be locking the associated mtx.

Returns: The address of the cloaked object..

Throws: lock_error if BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED is not defined and the lk parameter doesn't satisfy the preconditions

References boost::BOOST_CONCEPT_ASSERT(), boost::BOOST_STATIC_ASSERT(), boost::interprocess::lock_error, and boost::program_options::value().

template<typename T , typename MutexType >
void boost::externally_locked< T &, MutexType >::lock ( void  )
inline
template<typename T , typename MutexType >
mutex_type* boost::externally_locked< T &, MutexType >::mutex ( ) const
inline
template<typename T , typename MutexType >
externally_locked& boost::externally_locked< T &, MutexType >::operator= ( externally_locked< T &, MutexType > const &  rhs)
inline

assignment

template<typename T , typename MutexType >
externally_locked& boost::externally_locked< T &, MutexType >::operator= ( BOOST_THREAD_RV_REF(externally_locked< T &, MutexType >)  rhs)
inline

move assignment

template<typename T , typename MutexType >
void boost::externally_locked< T &, MutexType >::swap ( externally_locked< T &, MutexType > &  rhs)
inline

References boost::swap.

template<typename T , typename MutexType >
bool boost::externally_locked< T &, MutexType >::try_lock ( void  )
inline
template<typename T , typename MutexType >
void boost::externally_locked< T &, MutexType >::unlock ( void  )
inline

Member Data Documentation

template<typename T , typename MutexType >
mutex_type* boost::externally_locked< T &, MutexType >::mtx_
protected
template<typename T , typename MutexType >
T* boost::externally_locked< T &, MutexType >::obj_
protected

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