NCBI C++ ToolKit
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CGuard< Resource, Lock, Unlock, ReportExceptions > Class Template Reference

Search Toolkit Book for CGuard

#include <corelib/guard.hpp>

+ Inheritance diagram for CGuard< Resource, Lock, Unlock, ReportExceptions >:
+ Collaboration diagram for CGuard< Resource, Lock, Unlock, ReportExceptions >:

Public Types

typedef Resource resource_type
 
typedef resource_typeresource_ptr
 
typedef Lock lock_type
 
typedef Unlock unlock_type
 
typedef CGuard< Resource, Lock, Unlock, ReportExceptions > TThisType
 
- Public Types inherited from CGuard_Base
enum  EReportExceptions { eReport , eSilent }
 Exception reporting options. More...
 

Public Member Functions

 CGuard (EEmptyGuard)
 
 CGuard (resource_type &resource)
 This constructor locks the resource passed. More...
 
 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. More...
 
 ~CGuard ()
 Destructor releases the resource. More...
 
void Release ()
 Manually force the resource to be released. More...
 
void Guard (resource_type &resource)
 Manually force the guard to protect some other resource. More...
 

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. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from CGuard_Base
static void ReportException (std::exception &ex)
 

Detailed Description

template<class Resource, class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
class CGuard< Resource, Lock, Unlock, ReportExceptions >

Examples
/home/coremake/doxygen/cxx/include/corelib/interprocess_lock.hpp.

Definition at line 117 of file guard.hpp.

Member Typedef Documentation

◆ lock_type

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
typedef Lock CGuard< Resource, Lock, Unlock, ReportExceptions >::lock_type

Definition at line 122 of file guard.hpp.

◆ resource_ptr

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

Definition at line 121 of file guard.hpp.

◆ resource_type

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
typedef Resource CGuard< Resource, Lock, Unlock, ReportExceptions >::resource_type

Definition at line 120 of file guard.hpp.

◆ TThisType

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
typedef CGuard<Resource, Lock, Unlock, ReportExceptions> CGuard< Resource, Lock, Unlock, ReportExceptions >::TThisType

Definition at line 124 of file guard.hpp.

◆ unlock_type

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
typedef Unlock CGuard< Resource, Lock, Unlock, ReportExceptions >::unlock_type

Definition at line 123 of file guard.hpp.

Constructor & Destructor Documentation

◆ CGuard() [1/5]

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
CGuard< Resource, Lock, Unlock, ReportExceptions >::CGuard ( EEmptyGuard  )
inlineexplicit

Definition at line 126 of file guard.hpp.

◆ CGuard() [2/5]

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
CGuard< Resource, Lock, Unlock, ReportExceptions >::CGuard ( resource_type resource)
inlineexplicit

This constructor locks the resource passed.

Definition at line 131 of file guard.hpp.

◆ CGuard() [3/5]

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
CGuard< Resource, Lock, Unlock, ReportExceptions >::CGuard ( EEmptyGuard  ,
const lock_type lock,
const unlock_type unlock = unlock_type() 
)
inlineexplicit

Definition at line 136 of file guard.hpp.

◆ CGuard() [4/5]

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
CGuard< Resource, Lock, Unlock, ReportExceptions >::CGuard ( resource_type resource,
const lock_type lock,
const unlock_type unlock = unlock_type() 
)
inlineexplicit

This constructor locks the resource passed.

Definition at line 144 of file guard.hpp.

◆ ~CGuard()

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
CGuard< Resource, Lock, Unlock, ReportExceptions >::~CGuard ( )
inline

Destructor releases the resource.

Definition at line 153 of file guard.hpp.

◆ CGuard() [5/5]

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
CGuard< Resource, Lock, Unlock, ReportExceptions >::CGuard ( const CGuard< resource_type, lock_type, unlock_type > &  )
private

Member Function Documentation

◆ GetLock()

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
lock_type& CGuard< Resource, Lock, Unlock, ReportExceptions >::GetLock ( void  )
inlineprotected

Definition at line 187 of file guard.hpp.

Referenced by CGuard< IRegistry, SSimpleReadLock< IRegistry > >::Guard().

◆ GetResource()

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
resource_ptr& CGuard< Resource, Lock, Unlock, ReportExceptions >::GetResource ( void  )
inlineprotected

◆ GetUnlock()

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
unlock_type& CGuard< Resource, Lock, Unlock, ReportExceptions >::GetUnlock ( void  )
inlineprotected

◆ Guard()

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
void CGuard< Resource, Lock, Unlock, ReportExceptions >::Guard ( resource_type resource)
inline

◆ operator=()

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
void CGuard< Resource, Lock, Unlock, ReportExceptions >::operator= ( const CGuard< resource_type, lock_type, unlock_type > &  )
private

◆ Release()

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
void CGuard< Resource, Lock, Unlock, ReportExceptions >::Release ( void  )
inline

Manually force the resource to be released.

Definition at line 166 of file guard.hpp.

Referenced by CObjectManager::AcquireDataLoader(), CObjectManager::AcquireSharedBioseq(), CObjectManager::AcquireSharedSeq_annot(), CObjectManager::AcquireSharedSeq_entry(), CScope_Impl::AddScope(), CFastLocalTime::CFastLocalTime(), CTLibContext::CTLIB_cterr_handler(), CTLibContext::CTLIB_srverr_handler(), CAppJobDispatcher::DeleteJob(), SNetServiceImpl::DiscoverServersIfNeeded(), CwxLogDiagHandler::DoLogRecord(), SNetServerInPool::GetConnectionFromPool(), CBlockingQueue< TRequest >::GetHandle(), CBlockingQueue_ForServer::GetHandle(), CFastLocalTime::GetLocalTime(), CServer_ConnectionPool::GetPollAndTimerVec(), CGuard< IRegistry, SSimpleReadLock< IRegistry > >::Guard(), CMetaRegistry::Load(), CSafeStaticPtr_Base::Lock(), CAsyncDiagThread::Main(), impl::CDriverContext::MakePooledConnection(), CAsyncDiagHandler::Post(), CwxLogDiagHandler::Post(), CPIDGuard::Release(), CTSE_LoadLockGuard::Release(), CThreadPool_Guard::Release(), CObjectManager::ReleaseDataSource(), CObjectManager::RevokeDataLoader(), CAsn2Asn::RunAsn2Asn(), impl::CDriverContext::SatisfyPoolMinimum(), CSafeStatic< CTls< TValue >, CStaticTls_Callbacks< TValue > >::sx_SelfCleanup(), CSafeStaticPtr< T >::sx_SelfCleanup(), CSafeStaticRef< CExtensionRegistry >::sx_SelfCleanup(), CTime::ToTime(), CQueue::TouchClientsRegistry(), CInfoCache_Base::x_AcquireLoadLock(), CInfoManager::x_AcquireLoadLock(), CTime::x_AdjustTimeImmediately(), CWGSDb_Impl::SAmbiguityInfo::x_Calculate4na(), CSafeStaticGuard::x_Cleanup(), CSeq_annot_Finder::x_Find(), CAppJobDispatcher::x_FlushStateEventQueue(), CMetaRegistry::x_Load(), CBioseq_Base_Info::x_PrefetchDesc(), CInitGuard::x_Release(), CScheduler_MT::x_SchedQueueChanged(), CAnnot_Collector::x_SearchRange(), CFastLocalTime::x_Tuneup(), CInfoManager::x_WaitForOtherLoader(), CBlockingQueue< TRequest >::x_WaitForPredicate(), and CGuard< IRegistry, SSimpleReadLock< IRegistry > >::~CGuard().

Member Data Documentation

◆ m_Data

template<class Resource , class Lock = SSimpleLock<Resource>, class Unlock = SSimpleUnlock<Resource>, CGuard_Base::EReportExceptions ReportExceptions = CGuard_Base::eReport>
pair_base_member<lock_type, pair_base_member<unlock_type, resource_ptr> > CGuard< Resource, Lock, Unlock, ReportExceptions >::m_Data
private

The documentation for this class was generated from the following file:
Modified on Fri Sep 20 14:57:03 2024 by modify_doxy.py rev. 669887