ldas-tools-al  2.6.7
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 >:
Collaboration graph
[legend]

Public Types

typedef ReadWriteLock::baton_type baton_type
 Baton. More...
 
typedef V element_type
 Type of variable. More...
 
typedef ReadWriteLock::baton_type baton_type
 Baton. More...
 
typedef V element_type
 Type of variable. More...
 
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. More...
 
V & Var ()
 Read/Write access to the variable. More...
 
 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. More...
 
V & Var ()
 Read/Write access to the variable. More...
 
 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. More...
 
V & Var ()
 Read/Write access to the variable. More...
 

Private Member Functions

 ReadWriteLockVariable ()
 
baton_type release (const char *File, int Line) const
 
 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.

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( )
{
}
MutexLock::baton_type baton()
Obtain lock.
Definition: ThreadPool.cc:56

Member Typedef Documentation

◆ baton_type [1/3]

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.

◆ baton_type [2/3]

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.

◆ baton_type [3/3]

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.

◆ element_type [1/3]

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/3]

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 [3/3]

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/12]

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/12]

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/12]

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/12]

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

◆ ReadWriteLockVariable() [5/12]

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/12]

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/12]

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/12]

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

◆ ReadWriteLockVariable() [9/12]

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() [10/12]

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() [11/12]

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() [12/12]

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

Member Function Documentation

◆ release() [1/3]

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

◆ release() [2/3]

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

◆ release() [3/3]

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

◆ Var() [1/6]

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

Read/Write access to the variable.

◆ Var() [2/6]

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

Read/Write access to the variable.

◆ Var() [3/6]

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

Read/Write access to the variable.

◆ Var() [4/6]

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

Read only access to the variable.

◆ Var() [5/6]

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

Read only access to the variable.

◆ Var() [6/6]

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 file: