MIDAS
Loading...
Searching...
No Matches
bm_lock_buffer_guard Class Reference
Collaboration diagram for bm_lock_buffer_guard:

Public Member Functions

 bm_lock_buffer_guard (BUFFER *pbuf, bool do_not_lock=false)
 
 ~bm_lock_buffer_guard ()
 
 bm_lock_buffer_guard (const bm_lock_buffer_guard &)=delete
 
bm_lock_buffer_guardoperator= (const bm_lock_buffer_guard &)=delete
 
void unlock ()
 
bool relock ()
 
void invalidate ()
 
bool is_locked () const
 
bool is_error () const
 
int get_status () const
 
BUFFERget_pbuf () const
 

Public Attributes

bool fDebug = false
 

Private Attributes

BUFFERfBuf = NULL
 
bool fLocked = false
 
bool fError = false
 
bool fInvalid = false
 
int fStatus = 0
 

Detailed Description

Definition at line 3093 of file midas.cxx.

Constructor & Destructor Documentation

◆ bm_lock_buffer_guard() [1/2]

bm_lock_buffer_guard::bm_lock_buffer_guard ( BUFFER pbuf,
bool  do_not_lock = false 
)
inline

Definition at line 3099 of file midas.cxx.

3100 {
3101 assert(pbuf != NULL);
3102 fBuf = pbuf;
3103 if (do_not_lock) {
3104 if (fDebug)
3105 printf("lock_buffer_guard(%s) ctor without lock\n", fBuf->buffer_name);
3106 return;
3107 }
3108 if (fDebug)
3109 printf("lock_buffer_guard(%s) ctor\n", fBuf->buffer_name);
3111 if (status != BM_SUCCESS) {
3112 fLocked = false;
3113 fError = true;
3114 fStatus = status;
3115 } else {
3116 fLocked = true;
3117 }
3118 }
static int xbm_lock_buffer(BUFFER *pbuf)
Definition midas.cxx:7997
#define BM_SUCCESS
Definition midas.h:605
DWORD status
Definition odbhist.cxx:39
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
char buffer_name[NAME_LENGTH]
Definition midas.h:991
Here is the call graph for this function:

◆ ~bm_lock_buffer_guard()

bm_lock_buffer_guard::~bm_lock_buffer_guard ( )
inline

Definition at line 3120 of file midas.cxx.

3121 {
3122 if (fInvalid) {
3123 if (fDebug)
3124 printf("lock_buffer_guard(invalid) dtor\n");
3125 } else {
3126 assert(fBuf != NULL);
3127 if (fDebug)
3128 printf("lock_buffer_guard(%s) dtor, locked %d, error %d\n", fBuf->buffer_name, fLocked, fError);
3129 if (fLocked) {
3131 fLocked = false;
3132 fError = false;
3133 }
3134 fBuf = NULL;
3135 }
3136 }
static void xbm_unlock_buffer(BUFFER *pbuf)
Definition midas.cxx:8059
Here is the call graph for this function:

◆ bm_lock_buffer_guard() [2/2]

bm_lock_buffer_guard::bm_lock_buffer_guard ( const bm_lock_buffer_guard )
delete

Member Function Documentation

◆ get_pbuf()

BUFFER * bm_lock_buffer_guard::get_pbuf ( ) const
inline

Definition at line 3195 of file midas.cxx.

3196 {
3197 assert(!fInvalid); // pbuf was deleted
3198 assert(fBuf); // we do not return NULL
3199 return fBuf;
3200 }

◆ get_status()

int bm_lock_buffer_guard::get_status ( ) const
inline

Definition at line 3190 of file midas.cxx.

3191 {
3192 return fStatus;
3193 }

◆ invalidate()

void bm_lock_buffer_guard::invalidate ( )
inline

Definition at line 3170 of file midas.cxx.

3171 {
3172 assert(fBuf != NULL);
3173 if (fDebug)
3174 printf("lock_buffer_guard(%s) invalidate, locked %d, error %d\n", fBuf->buffer_name, fLocked, fError);
3175 assert(!fLocked);
3176 fInvalid = true;
3177 fBuf = NULL;
3178 }
Here is the call graph for this function:

◆ is_error()

bool bm_lock_buffer_guard::is_error ( ) const
inline

Definition at line 3185 of file midas.cxx.

3186 {
3187 return fError;
3188 }

◆ is_locked()

bool bm_lock_buffer_guard::is_locked ( ) const
inline

Definition at line 3180 of file midas.cxx.

3181 {
3182 return fLocked;
3183 }

◆ operator=()

bm_lock_buffer_guard & bm_lock_buffer_guard::operator= ( const bm_lock_buffer_guard )
delete

◆ relock()

bool bm_lock_buffer_guard::relock ( )
inline

Definition at line 3153 of file midas.cxx.

3154 {
3155 assert(fBuf != NULL);
3156 if (fDebug)
3157 printf("lock_buffer_guard(%s) relock, locked %d, error %d\n", fBuf->buffer_name, fLocked, fError);
3158 assert(!fLocked);
3160 if (status != BM_SUCCESS) {
3161 fLocked = false;
3162 fError = true;
3163 fStatus = status;
3164 } else {
3165 fLocked = true;
3166 }
3167 return fLocked;
3168 }
Here is the call graph for this function:

◆ unlock()

void bm_lock_buffer_guard::unlock ( )
inline

Definition at line 3142 of file midas.cxx.

3143 {
3144 assert(fBuf != NULL);
3145 if (fDebug)
3146 printf("lock_buffer_guard(%s) unlock, locked %d, error %d\n", fBuf->buffer_name, fLocked, fError);
3147 assert(fLocked);
3149 fLocked = false;
3150 fError = false;
3151 }
Here is the call graph for this function:

Member Data Documentation

◆ fBuf

BUFFER* bm_lock_buffer_guard::fBuf = NULL
private

Definition at line 3203 of file midas.cxx.

◆ fDebug

bool bm_lock_buffer_guard::fDebug = false

Definition at line 3096 of file midas.cxx.

◆ fError

bool bm_lock_buffer_guard::fError = false
private

Definition at line 3205 of file midas.cxx.

◆ fInvalid

bool bm_lock_buffer_guard::fInvalid = false
private

Definition at line 3206 of file midas.cxx.

◆ fLocked

bool bm_lock_buffer_guard::fLocked = false
private

Definition at line 3204 of file midas.cxx.

◆ fStatus

int bm_lock_buffer_guard::fStatus = 0
private

Definition at line 3207 of file midas.cxx.


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