ldas-tools-al  2.5.7
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions | List of all members
LDASTools::AL::ReadWriteLockVariable< T, V > Class Template Reference

Implements read/write lock symantics for a variable. More...

#include <ReadWriteLock.hh>

Public Types

typedef ReadWriteLock::baton_type baton_type
 Baton. More...
 
typedef V element_type
 Type of variable. More...
 

Public Member Functions

 ReadWriteLockVariable (baton_type Baton, int Timeout, V &Variable, const char *Filename, int Linenum)
 Constructor. More...
 
 ReadWriteLockVariable (baton_type Baton, int Timeout, const V &Variable, const char *Filename, int Linenum)
 Constructor. More...
 
 ReadWriteLockVariable (const ReadWriteLockVariable &Source, const char *Filename, int Linenum)
 Copy constructor. More...
 
const V & Var () const
 Read only access to the variable.
 
V & Var ()
 Read/Write access to the variable.
 

Detailed Description

template<ReadWriteLock::mode_type T, typename V>
class LDASTools::AL::ReadWriteLockVariable< T, V >

Implements read/write lock symantics for a variable.

This class allows for manipulation of variables to be thread safe.

ReadWriteLock::baton_type baton;
std::string v;
ReadWriteLockVariable< ReadWriteLock::Write, std::string >
lock( baton, 0, v);
try
{
if ( lock.Var( ).size( ) == 0 )
{
lock.Var( ).assign( "New value" );
}
}
catch( )
{
}

Member Typedef Documentation

template<ReadWriteLock::mode_type T, typename V >
typedef ReadWriteLock::baton_type LDASTools::AL::ReadWriteLockVariable< T, V >::baton_type

Baton.

The resource used to manage resouce access.

template<ReadWriteLock::mode_type T, typename V >
typedef V LDASTools::AL::ReadWriteLockVariable< T, V >::element_type

Type of variable.

The type of variable being managed.

Constructor & Destructor Documentation

template<ReadWriteLock::mode_type T, typename V >
LDASTools::AL::ReadWriteLockVariable< T, V >::ReadWriteLockVariable ( baton_type  Baton,
int  Timeout,
V &  Variable,
const char *  Filename,
int  Linenum 
)
inline

Constructor.

Parameters
[in]BatonBaton controlling access to the resource.
[in]TimeoutMaximum length of time to wait on obtaining the lock.
[in]VariableVariable being managed by the class.
[in]FilenameThe filename from where the call was made.
[in]LinenumThe line number from where the call was made.
template<ReadWriteLock::mode_type T, typename V >
LDASTools::AL::ReadWriteLockVariable< T, V >::ReadWriteLockVariable ( baton_type  Baton,
int  Timeout,
const V &  Variable,
const char *  Filename,
int  Linenum 
)
inline

Constructor.

Parameters
[in]BatonBaton controlling access to the resource.
[in]TimeoutMaximum length of time to wait on obtaining the lock.
[in]VariableVariable being managed by the class.
[in]FilenameThe filename from where the call was made.
[in]LinenumThe line number from where the call was made.
template<ReadWriteLock::mode_type T, typename V >
LDASTools::AL::ReadWriteLockVariable< T, V >::ReadWriteLockVariable ( const ReadWriteLockVariable< T, V > &  Source,
const char *  Filename,
int  Linenum 
)
inline

Copy constructor.

Parameters
[in]SourceSource from which to initialize.
[in]FilenameThe filename from where the call was made.
[in]LinenumThe line number from where the call was made.

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