ldas-tools-al 2.6.7
 
Loading...
Searching...
No Matches
LDASTools::AL::ReadWriteLockVariable< T, V > Class Template Reference

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

#include <ReadWriteLock.hh>

Collaboration diagram for LDASTools::AL::ReadWriteLockVariable< T, V >:

Public Types

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

Public Member Functions

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

Private Member Functions

 ReadWriteLockVariable ()
 
baton_type release (const char *File, int Line) const
 
 ReadWriteLockVariable ()
 
baton_type release (const char *File, int Line) const
 

Private Attributes

baton_type m_baton
 
int m_timeout
 
V & m_variable
 
ReadWriteLock m_lock
 
bool m_is_locked
 
const bool m_is_read_only
 

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.

std::string v;
lock( baton, 0, v);
try
{
if ( lock.Var( ).size( ) == 0 )
{
lock.Var( ).assign( "New value" );
}
}
catch( )
{
}
ReadWriteLockVariable(baton_type Baton, int Timeout, V &Variable, const char *Filename, int Linenum)
Constructor.
Definition ReadWriteLock.hh:521
Manager of the read/write lock resource.
Definition ReadWriteLock.hh:169
SingletonHolder< T, C, L >::baton_type SingletonHolder< T, C, L >::baton
Definition Singleton.hh:153

Member Typedef Documentation

◆ baton_type [1/2]

Baton.

The resource used to manage resouce access.

◆ baton_type [2/2]

Baton.

The resource used to manage resouce access.

◆ element_type [1/2]

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.

◆ element_type [2/2]

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

◆ ReadWriteLockVariable() [1/8]

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.

◆ ReadWriteLockVariable() [2/8]

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.

◆ ReadWriteLockVariable() [3/8]

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.

◆ ReadWriteLockVariable() [4/8]

template<ReadWriteLock::mode_type T, typename V>
LDASTools::AL::ReadWriteLockVariable< T, V >::ReadWriteLockVariable ( )
private

◆ ReadWriteLockVariable() [5/8]

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 )

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.

◆ ReadWriteLockVariable() [6/8]

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 )

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.

◆ ReadWriteLockVariable() [7/8]

template<ReadWriteLock::mode_type T, typename V>
LDASTools::AL::ReadWriteLockVariable< T, V >::ReadWriteLockVariable ( const ReadWriteLockVariable< T, V > & Source,
const char * Filename,
int Linenum )

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.

◆ ReadWriteLockVariable() [8/8]

template<ReadWriteLock::mode_type T, typename V>
LDASTools::AL::ReadWriteLockVariable< T, V >::ReadWriteLockVariable ( )
private

Member Function Documentation

◆ release() [1/2]

template<ReadWriteLock::mode_type T, typename V>
baton_type LDASTools::AL::ReadWriteLockVariable< T, V >::release ( const char * File,
int Line ) const
inlineprivate

◆ release() [2/2]

template<ReadWriteLock::mode_type T, typename V>
baton_type LDASTools::AL::ReadWriteLockVariable< T, V >::release ( const char * File,
int Line ) const
inlineprivate

◆ Var() [1/4]

template<ReadWriteLock::mode_type T, typename V>
V & LDASTools::AL::ReadWriteLockVariable< T, V >::Var ( )
inline

Read/Write access to the variable.

◆ Var() [2/4]

template<ReadWriteLock::mode_type T, typename V>
V & LDASTools::AL::ReadWriteLockVariable< T, V >::Var ( )

Read/Write access to the variable.

◆ Var() [3/4]

template<ReadWriteLock::mode_type T, typename V>
const V & LDASTools::AL::ReadWriteLockVariable< T, V >::Var ( ) const
inline

Read only access to the variable.

◆ Var() [4/4]

template<ReadWriteLock::mode_type T, typename V>
const V & LDASTools::AL::ReadWriteLockVariable< T, V >::Var ( ) const

Read only access to the variable.

Member Data Documentation

◆ m_baton

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

◆ m_is_locked

template<ReadWriteLock::mode_type T, typename V>
bool LDASTools::AL::ReadWriteLockVariable< T, V >::m_is_locked
mutableprivate

◆ m_is_read_only

template<ReadWriteLock::mode_type T, typename V>
const bool LDASTools::AL::ReadWriteLockVariable< T, V >::m_is_read_only
private

◆ m_lock

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

◆ m_timeout

template<ReadWriteLock::mode_type T, typename V>
int LDASTools::AL::ReadWriteLockVariable< T, V >::m_timeout
private

◆ m_variable

template<ReadWriteLock::mode_type T, typename V>
V & LDASTools::AL::ReadWriteLockVariable< T, V >::m_variable
private

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