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 3151 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 3157 of file midas.cxx.

3158 {
3159 assert(pbuf != NULL);
3160 fBuf = pbuf;
3161 if (do_not_lock) {
3162 if (fDebug)
3163 printf("lock_buffer_guard(%s) ctor without lock\n", fBuf->buffer_name);
3164 return;
3165 }
3166 if (fDebug)
3167 printf("lock_buffer_guard(%s) ctor\n", fBuf->buffer_name);
3169 if (status != BM_SUCCESS) {
3170 fLocked = false;
3171 fError = true;
3172 fStatus = status;
3173 } else {
3174 fLocked = true;
3175 }
3176 }
static int xbm_lock_buffer(BUFFER *pbuf)
Definition midas.cxx:8088
#define BM_SUCCESS
Definition midas.h:605
DWORD status
Definition odbhist.cxx:39
char buffer_name[NAME_LENGTH]
Definition midas.h:992
Here is the call graph for this function:

◆ ~bm_lock_buffer_guard()

bm_lock_buffer_guard::~bm_lock_buffer_guard ( )
inline

Definition at line 3178 of file midas.cxx.

3179 {
3180 if (fInvalid) {
3181 if (fDebug)
3182 printf("lock_buffer_guard(invalid) dtor\n");
3183 } else {
3184 assert(fBuf != NULL);
3185 if (fDebug)
3186 printf("lock_buffer_guard(%s) dtor, locked %d, error %d\n", fBuf->buffer_name, fLocked, fError);
3187 if (fLocked) {
3189 fLocked = false;
3190 fError = false;
3191 }
3192 fBuf = NULL;
3193 }
3194 }
static void xbm_unlock_buffer(BUFFER *pbuf)
Definition midas.cxx:8150
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 3253 of file midas.cxx.

3254 {
3255 assert(!fInvalid); // pbuf was deleted
3256 assert(fBuf); // we do not return NULL
3257 return fBuf;
3258 }
Here is the caller graph for this function:

◆ get_status()

int bm_lock_buffer_guard::get_status ( ) const
inline

Definition at line 3248 of file midas.cxx.

3249 {
3250 return fStatus;
3251 }
Here is the caller graph for this function:

◆ invalidate()

void bm_lock_buffer_guard::invalidate ( )
inline

Definition at line 3228 of file midas.cxx.

3229 {
3230 assert(fBuf != NULL);
3231 if (fDebug)
3232 printf("lock_buffer_guard(%s) invalidate, locked %d, error %d\n", fBuf->buffer_name, fLocked, fError);
3233 assert(!fLocked);
3234 fInvalid = true;
3235 fBuf = NULL;
3236 }
Here is the caller graph for this function:

◆ is_error()

bool bm_lock_buffer_guard::is_error ( ) const
inline

Definition at line 3243 of file midas.cxx.

3244 {
3245 return fError;
3246 }

◆ is_locked()

bool bm_lock_buffer_guard::is_locked ( ) const
inline

Definition at line 3238 of file midas.cxx.

3239 {
3240 return fLocked;
3241 }
Here is the caller graph for this function:

◆ 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 3211 of file midas.cxx.

3212 {
3213 assert(fBuf != NULL);
3214 if (fDebug)
3215 printf("lock_buffer_guard(%s) relock, locked %d, error %d\n", fBuf->buffer_name, fLocked, fError);
3216 assert(!fLocked);
3218 if (status != BM_SUCCESS) {
3219 fLocked = false;
3220 fError = true;
3221 fStatus = status;
3222 } else {
3223 fLocked = true;
3224 }
3225 return fLocked;
3226 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unlock()

void bm_lock_buffer_guard::unlock ( )
inline

Definition at line 3200 of file midas.cxx.

3201 {
3202 assert(fBuf != NULL);
3203 if (fDebug)
3204 printf("lock_buffer_guard(%s) unlock, locked %d, error %d\n", fBuf->buffer_name, fLocked, fError);
3205 assert(fLocked);
3207 fLocked = false;
3208 fError = false;
3209 }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ fBuf

BUFFER* bm_lock_buffer_guard::fBuf = NULL
private

Definition at line 3261 of file midas.cxx.

◆ fDebug

bool bm_lock_buffer_guard::fDebug = false

Definition at line 3154 of file midas.cxx.

◆ fError

bool bm_lock_buffer_guard::fError = false
private

Definition at line 3263 of file midas.cxx.

◆ fInvalid

bool bm_lock_buffer_guard::fInvalid = false
private

Definition at line 3264 of file midas.cxx.

◆ fLocked

bool bm_lock_buffer_guard::fLocked = false
private

Definition at line 3262 of file midas.cxx.

◆ fStatus

int bm_lock_buffer_guard::fStatus = 0
private

Definition at line 3265 of file midas.cxx.


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