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 3095 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 3101 of file midas.cxx.

3102 {
3103 assert(pbuf != NULL);
3104 fBuf = pbuf;
3105 if (do_not_lock) {
3106 if (fDebug)
3107 printf("lock_buffer_guard(%s) ctor without lock\n", fBuf->buffer_name);
3108 return;
3109 }
3110 if (fDebug)
3111 printf("lock_buffer_guard(%s) ctor\n", fBuf->buffer_name);
3113 if (status != BM_SUCCESS) {
3114 fLocked = false;
3115 fError = true;
3116 fStatus = status;
3117 } else {
3118 fLocked = true;
3119 }
3120 }
static int xbm_lock_buffer(BUFFER *pbuf)
Definition midas.cxx:7986
#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 3122 of file midas.cxx.

3123 {
3124 if (fInvalid) {
3125 if (fDebug)
3126 printf("lock_buffer_guard(invalid) dtor\n");
3127 } else {
3128 assert(fBuf != NULL);
3129 if (fDebug)
3130 printf("lock_buffer_guard(%s) dtor, locked %d, error %d\n", fBuf->buffer_name, fLocked, fError);
3131 if (fLocked) {
3133 fLocked = false;
3134 fError = false;
3135 }
3136 fBuf = NULL;
3137 }
3138 }
static void xbm_unlock_buffer(BUFFER *pbuf)
Definition midas.cxx:8048
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 3197 of file midas.cxx.

3198 {
3199 assert(!fInvalid); // pbuf was deleted
3200 assert(fBuf); // we do not return NULL
3201 return fBuf;
3202 }
Here is the caller graph for this function:

◆ get_status()

int bm_lock_buffer_guard::get_status ( ) const
inline

Definition at line 3192 of file midas.cxx.

3193 {
3194 return fStatus;
3195 }
Here is the caller graph for this function:

◆ invalidate()

void bm_lock_buffer_guard::invalidate ( )
inline

Definition at line 3172 of file midas.cxx.

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

◆ is_error()

bool bm_lock_buffer_guard::is_error ( ) const
inline

Definition at line 3187 of file midas.cxx.

3188 {
3189 return fError;
3190 }

◆ is_locked()

bool bm_lock_buffer_guard::is_locked ( ) const
inline

Definition at line 3182 of file midas.cxx.

3183 {
3184 return fLocked;
3185 }
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 3155 of file midas.cxx.

3156 {
3157 assert(fBuf != NULL);
3158 if (fDebug)
3159 printf("lock_buffer_guard(%s) relock, locked %d, error %d\n", fBuf->buffer_name, fLocked, fError);
3160 assert(!fLocked);
3162 if (status != BM_SUCCESS) {
3163 fLocked = false;
3164 fError = true;
3165 fStatus = status;
3166 } else {
3167 fLocked = true;
3168 }
3169 return fLocked;
3170 }
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 3144 of file midas.cxx.

3145 {
3146 assert(fBuf != NULL);
3147 if (fDebug)
3148 printf("lock_buffer_guard(%s) unlock, locked %d, error %d\n", fBuf->buffer_name, fLocked, fError);
3149 assert(fLocked);
3151 fLocked = false;
3152 fError = false;
3153 }
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 3205 of file midas.cxx.

◆ fDebug

bool bm_lock_buffer_guard::fDebug = false

Definition at line 3098 of file midas.cxx.

◆ fError

bool bm_lock_buffer_guard::fError = false
private

Definition at line 3207 of file midas.cxx.

◆ fInvalid

bool bm_lock_buffer_guard::fInvalid = false
private

Definition at line 3208 of file midas.cxx.

◆ fLocked

bool bm_lock_buffer_guard::fLocked = false
private

Definition at line 3206 of file midas.cxx.

◆ fStatus

int bm_lock_buffer_guard::fStatus = 0
private

Definition at line 3209 of file midas.cxx.


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