CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RAII< T, P > Class Template Reference

#include <mutex.h>

Inheritance diagram for RAII< T, P >:
Collaboration diagram for RAII< T, P >:

Public Member Functions

 RAII (T &object)
 
 RAII (T *object)
 
 ~RAII ()
 

Protected Member Functions

void Enter ()
 
void Leave ()
 
template<>
void Enter ()
 
template<>
void Leave ()
 
template<>
void Enter ()
 
template<>
void Leave ()
 
template<>
void Enter ()
 
template<>
void Leave ()
 

Private Attributes

T & ref_
 

Additional Inherited Members

- Private Member Functions inherited from SingleCopy
 SingleCopy ()
 

Detailed Description

template<typename T, RAII_Polymorphism::T P = RAII_Polymorphism::None>
class RAII< T, P >

Basic template wrapper class for any kind of RAII-like behavior. The user is supposed to provide a template specialization of Enter() and Leave(). On creation of the RAII object it will call Enter() respectively Leave() on destruction. The gold standard example is a LockGard (see below).

Note: Resource Acquisition Is Initialization (Bjarne Stroustrup)

Definition at line 42 of file mutex.h.

Constructor & Destructor Documentation

template<typename T, RAII_Polymorphism::T P = RAII_Polymorphism::None>
RAII< T, P >::RAII ( T &  object)
inlineexplicit

Definition at line 44 of file mutex.h.

template<typename T, RAII_Polymorphism::T P = RAII_Polymorphism::None>
RAII< T, P >::RAII ( T *  object)
inlineexplicit

Definition at line 45 of file mutex.h.

template<typename T, RAII_Polymorphism::T P = RAII_Polymorphism::None>
RAII< T, P >::~RAII ( )
inline

Definition at line 46 of file mutex.h.

Member Function Documentation

template<typename T, RAII_Polymorphism::T P = RAII_Polymorphism::None>
void RAII< T, P >::Enter ( )
inlineprotected

Definition at line 49 of file mutex.h.

template<>
void RAII< pthread_mutex_t >::Enter ( )
inlineprotected

Definition at line 76 of file mutex.h.

template<>
void RAII< pthread_rwlock_t, RAII_Polymorphism::ReadLock >::Enter ( )
inlineprotected

Definition at line 84 of file mutex.h.

template<>
void RAII< pthread_rwlock_t, RAII_Polymorphism::WriteLock >::Enter ( )
inlineprotected

Definition at line 94 of file mutex.h.

template<typename T, RAII_Polymorphism::T P = RAII_Polymorphism::None>
void RAII< T, P >::Leave ( )
inlineprotected

Definition at line 50 of file mutex.h.

template<>
void RAII< pthread_mutex_t >::Leave ( )
inlineprotected

Definition at line 78 of file mutex.h.

template<>
void RAII< pthread_rwlock_t, RAII_Polymorphism::ReadLock >::Leave ( )
inlineprotected

Definition at line 89 of file mutex.h.

template<>
void RAII< pthread_rwlock_t, RAII_Polymorphism::WriteLock >::Leave ( )
inlineprotected

Definition at line 99 of file mutex.h.

Member Data Documentation

template<typename T, RAII_Polymorphism::T P = RAII_Polymorphism::None>
T& RAII< T, P >::ref_
private

Definition at line 53 of file mutex.h.


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