CGuard< Resource, Lock, Unlock > Class Template Reference

Search Toolkit Book for CGuard

#include <guard.hpp>

Inheritance diagram for CGuard< Resource, Lock, Unlock >:

Inheritance graph
[legend]
Collaboration diagram for CGuard< Resource, Lock, Unlock >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
class CGuard< Resource, Lock, Unlock >

Definition at line 100 of file guard.hpp.

Public Types

typedef Resource resource_type
typedef resource_typeresource_ptr
typedef Lock lock_type
typedef Unlock unlock_type
typedef CGuard< Resource,
Lock, Unlock > 
TThisType

Public Member Functions

 CGuard (EEmptyGuard)
 CGuard (resource_type &resource)
 This constructor locks the resource passed.
 CGuard (EEmptyGuard, const lock_type &lock, const unlock_type &unlock=unlock_type())
 CGuard (resource_type &resource, const lock_type &lock, const unlock_type &unlock=unlock_type())
 This constructor locks the resource passed.
 ~CGuard ()
 Destructor releases the resource.
void Release ()
 Manually force the resource to be released.
void Guard (resource_type &resource)
 Manually force the guard to protect some other resource.

Protected Member Functions

resource_ptrGetResource (void)
lock_typeGetLock (void)
unlock_typeGetUnlock (void)

Private Member Functions

 CGuard (const CGuard< resource_type, lock_type, unlock_type > &)
void operator= (const CGuard< resource_type, lock_type, unlock_type > &)

Private Attributes

pair_base_member< lock_type,
pair_base_member< unlock_type,
resource_ptr > > 
m_Data
 Maintain a pointer to the original resource that is being guarded.


Member Typedef Documentation

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
typedef Lock CGuard< Resource, Lock, Unlock >::lock_type
 

Definition at line 105 of file guard.hpp.

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
typedef resource_type* CGuard< Resource, Lock, Unlock >::resource_ptr
 

Definition at line 104 of file guard.hpp.

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
typedef Resource CGuard< Resource, Lock, Unlock >::resource_type
 

Definition at line 103 of file guard.hpp.

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
typedef CGuard<Resource, Lock, Unlock> CGuard< Resource, Lock, Unlock >::TThisType
 

Definition at line 107 of file guard.hpp.

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
typedef Unlock CGuard< Resource, Lock, Unlock >::unlock_type
 

Definition at line 106 of file guard.hpp.


Constructor & Destructor Documentation

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
CGuard< Resource, Lock, Unlock >::CGuard EEmptyGuard   )  [inline, explicit]
 

Definition at line 109 of file guard.hpp.

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
CGuard< Resource, Lock, Unlock >::CGuard resource_type resource  )  [inline, explicit]
 

This constructor locks the resource passed.

Definition at line 114 of file guard.hpp.

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
CGuard< Resource, Lock, Unlock >::CGuard EEmptyGuard  ,
const lock_type lock,
const unlock_type unlock = unlock_type()
[inline, explicit]
 

Definition at line 119 of file guard.hpp.

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
CGuard< Resource, Lock, Unlock >::CGuard resource_type resource,
const lock_type lock,
const unlock_type unlock = unlock_type()
[inline, explicit]
 

This constructor locks the resource passed.

Definition at line 127 of file guard.hpp.

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
CGuard< Resource, Lock, Unlock >::~CGuard  )  [inline]
 

Destructor releases the resource.

Definition at line 136 of file guard.hpp.

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
CGuard< Resource, Lock, Unlock >::CGuard const CGuard< resource_type, lock_type, unlock_type > &   )  [private]
 


Member Function Documentation

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
lock_type& CGuard< Resource, Lock, Unlock >::GetLock void   )  [inline, protected]
 

Definition at line 167 of file guard.hpp.

Referenced by CGuard< SSystemMutex >::Guard().

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
resource_ptr& CGuard< Resource, Lock, Unlock >::GetResource void   )  [inline, protected]
 

Definition at line 163 of file guard.hpp.

Referenced by CGuard< SSystemMutex >::Guard(), and CGuard< SSystemMutex >::Release().

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
unlock_type& CGuard< Resource, Lock, Unlock >::GetUnlock void   )  [inline, protected]
 

Definition at line 171 of file guard.hpp.

Referenced by CGuard< SSystemMutex >::Release().

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
void CGuard< Resource, Lock, Unlock >::Guard resource_type resource  )  [inline]
 

Manually force the guard to protect some other resource.

Definition at line 155 of file guard.hpp.

Referenced by CGuard< SSystemMutex >::CGuard(), CInitGuard::CInitGuard(), CNCMMDBCache::DestroyOnePage(), and CBlockingQueue< TRequest >::x_WaitForPredicate().

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
void CGuard< Resource, Lock, Unlock >::operator= const CGuard< resource_type, lock_type, unlock_type > &   )  [private]
 

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
void CGuard< Resource, Lock, Unlock >::Release  )  [inline]
 

Manually force the resource to be released.

Reimplemented in CThreadPool_Guard.

Definition at line 146 of file guard.hpp.

Referenced by CObjectManager::AcquireDataLoader(), CObjectManager::AcquireSharedBioseq(), CObjectManager::AcquireSharedSeq_annot(), CObjectManager::AcquireSharedSeq_entry(), CNCMMDBCache::DestroyOnePage(), CGuard< SSystemMutex >::Guard(), CTSE_LoadLockGuard::Release(), CObjectManager::ReleaseDataSource(), CObjectManager::RevokeDataLoader(), CAsn2Asn::RunAsn2Asn(), CScheduler_MT::x_SchedQueueChanged(), CBlockingQueue< TRequest >::x_WaitForPredicate(), and CGuard< SSystemMutex >::~CGuard().


Member Data Documentation

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>>
pair_base_member<lock_type, pair_base_member<unlock_type, resource_ptr> > CGuard< Resource, Lock, Unlock >::m_Data [private]
 

Maintain a pointer to the original resource that is being guarded.

Definition at line 180 of file guard.hpp.

Referenced by CGuard< SSystemMutex >::GetLock(), CGuard< SSystemMutex >::GetResource(), and CGuard< SSystemMutex >::GetUnlock().


The documentation for this class was generated from the following file:
Generated on Mon Dec 7 12:02:29 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:23:13 2009 by modify_doxy.py rev. 173732