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 3079 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 3085 of file midas.cxx.

3086 {
3087 assert(pbuf != NULL);
3088 fBuf = pbuf;
3089 if (do_not_lock) {
3090 if (fDebug)
3091 printf("lock_buffer_guard(%s) ctor without lock\n", fBuf->buffer_name);
3092 return;
3093 }
3094 if (fDebug)
3095 printf("lock_buffer_guard(%s) ctor\n", fBuf->buffer_name);
3097 if (status != BM_SUCCESS) {
3098 fLocked = false;
3099 fError = true;
3100 fStatus = status;
3101 } else {
3102 fLocked = true;
3103 }
3104 }
static int xbm_lock_buffer(BUFFER *pbuf)
Definition midas.cxx:7975
#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 3106 of file midas.cxx.

3107 {
3108 if (fInvalid) {
3109 if (fDebug)
3110 printf("lock_buffer_guard(invalid) dtor\n");
3111 } else {
3112 assert(fBuf != NULL);
3113 if (fDebug)
3114 printf("lock_buffer_guard(%s) dtor, locked %d, error %d\n", fBuf->buffer_name, fLocked, fError);
3115 if (fLocked) {
3117 fLocked = false;
3118 fError = false;
3119 }
3120 fBuf = NULL;
3121 }
3122 }
static void xbm_unlock_buffer(BUFFER *pbuf)
Definition midas.cxx:8037
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 3181 of file midas.cxx.

3182 {
3183 assert(!fInvalid); // pbuf was deleted
3184 assert(fBuf); // we do not return NULL
3185 return fBuf;
3186 }

◆ get_status()

int bm_lock_buffer_guard::get_status ( ) const
inline

Definition at line 3176 of file midas.cxx.

3177 {
3178 return fStatus;
3179 }

◆ invalidate()

void bm_lock_buffer_guard::invalidate ( )
inline

Definition at line 3156 of file midas.cxx.

3157 {
3158 assert(fBuf != NULL);
3159 if (fDebug)
3160 printf("lock_buffer_guard(%s) invalidate, locked %d, error %d\n", fBuf->buffer_name, fLocked, fError);
3161 assert(!fLocked);
3162 fInvalid = true;
3163 fBuf = NULL;
3164 }
Here is the call graph for this function:

◆ is_error()

bool bm_lock_buffer_guard::is_error ( ) const
inline

Definition at line 3171 of file midas.cxx.

3172 {
3173 return fError;
3174 }

◆ is_locked()

bool bm_lock_buffer_guard::is_locked ( ) const
inline

Definition at line 3166 of file midas.cxx.

3167 {
3168 return fLocked;
3169 }

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

3140 {
3141 assert(fBuf != NULL);
3142 if (fDebug)
3143 printf("lock_buffer_guard(%s) relock, locked %d, error %d\n", fBuf->buffer_name, fLocked, fError);
3144 assert(!fLocked);
3146 if (status != BM_SUCCESS) {
3147 fLocked = false;
3148 fError = true;
3149 fStatus = status;
3150 } else {
3151 fLocked = true;
3152 }
3153 return fLocked;
3154 }
Here is the call graph for this function:

◆ unlock()

void bm_lock_buffer_guard::unlock ( )
inline

Definition at line 3128 of file midas.cxx.

3129 {
3130 assert(fBuf != NULL);
3131 if (fDebug)
3132 printf("lock_buffer_guard(%s) unlock, locked %d, error %d\n", fBuf->buffer_name, fLocked, fError);
3133 assert(fLocked);
3135 fLocked = false;
3136 fError = false;
3137 }
Here is the call graph for this function:

Member Data Documentation

◆ fBuf

BUFFER* bm_lock_buffer_guard::fBuf = NULL
private

Definition at line 3189 of file midas.cxx.

◆ fDebug

bool bm_lock_buffer_guard::fDebug = false

Definition at line 3082 of file midas.cxx.

◆ fError

bool bm_lock_buffer_guard::fError = false
private

Definition at line 3191 of file midas.cxx.

◆ fInvalid

bool bm_lock_buffer_guard::fInvalid = false
private

Definition at line 3192 of file midas.cxx.

◆ fLocked

bool bm_lock_buffer_guard::fLocked = false
private

Definition at line 3190 of file midas.cxx.

◆ fStatus

int bm_lock_buffer_guard::fStatus = 0
private

Definition at line 3193 of file midas.cxx.


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