ldas-tools-al  2.6.4
Public Member Functions | Private Attributes | List of all members
ObjectRegistry< T >::AutoLock Class Reference

Ensure release of resource lock. More...

#include <objectregistry.hh>

Inheritance diagram for ObjectRegistry< T >::AutoLock:
Inheritance graph
[legend]

Public Member Functions

 AutoLock (T *Resource, ObjectRegistry< T > &Registry)
 Constructor. More...
 
 ~AutoLock ()
 Desctructor. More...
 
 AutoLock (T *Resource, ObjectRegistry< T > &Registry)
 Constructor. More...
 
 ~AutoLock ()
 Desctructor. More...
 
 AutoLock (T *Resource, ObjectRegistry< T > &Registry)
 Constructor. More...
 
 ~AutoLock ()
 Desctructor. More...
 

Private Attributes

T * m_resource
 Resource object. More...
 
ObjectRegistry< T > & m_registry
 Registry object. More...
 

Detailed Description

template<class T>
class ObjectRegistry< T >::AutoLock

Ensure release of resource lock.

This class ensures the release of a lock by performing the release within the destructor. By releasing in the destructor, the lock is release when the object goes out of scope, either by normal exit or via an exception.

Constructor & Destructor Documentation

◆ AutoLock() [1/3]

template<class T>
ObjectRegistry< T >::AutoLock::AutoLock ( T *  Resource,
ObjectRegistry< T > &  Registry 
)
inline

Constructor.

The constructor is responsible for locking the resouce.

Parameters
ResourceThe address of the resource that should be locked
RegistryThis is the list of registered objects being managed. Resource should be managed within Registry.
Exceptions
std::range_errorThis exception is throw if Resource is not being managed by Registry.

◆ ~AutoLock() [1/3]

template<class T>
ObjectRegistry< T >::AutoLock::~AutoLock ( )
inline

Desctructor.

Unlock the resouce.

◆ AutoLock() [2/3]

template<class T>
ObjectRegistry< T >::AutoLock::AutoLock ( T *  Resource,
ObjectRegistry< T > &  Registry 
)
inline

Constructor.

The constructor is responsible for locking the resouce.

Parameters
ResourceThe address of the resource that should be locked
RegistryThis is the list of registered objects being managed. Resource should be managed within Registry.
Exceptions
std::range_errorThis exception is throw if Resource is not being managed by Registry.

◆ ~AutoLock() [2/3]

template<class T>
ObjectRegistry< T >::AutoLock::~AutoLock ( )
inline

Desctructor.

Unlock the resouce.

◆ AutoLock() [3/3]

template<class T>
ObjectRegistry< T >::AutoLock::AutoLock ( T *  Resource,
ObjectRegistry< T > &  Registry 
)
inline

Constructor.

The constructor is responsible for locking the resouce.

Parameters
ResourceThe address of the resource that should be locked
RegistryThis is the list of registered objects being managed. Resource should be managed within Registry.
Exceptions
std::range_errorThis exception is throw if Resource is not being managed by Registry.

◆ ~AutoLock() [3/3]

template<class T>
ObjectRegistry< T >::AutoLock::~AutoLock ( )
inline

Desctructor.

Unlock the resouce.

Member Data Documentation

◆ m_registry

template<class T>
ObjectRegistry< T > & ObjectRegistry< T >::AutoLock::m_registry
private

Registry object.

This is the registry that should contain the resouce.

◆ m_resource

template<class T>
T * ObjectRegistry< T >::AutoLock::m_resource
private

Resource object.

This is the resource that is being locked.


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