MIDAS
Loading...
Searching...
No Matches
HsSchema Class Referenceabstract
Inheritance diagram for HsSchema:
Collaboration diagram for HsSchema:

Public Member Functions

 HsSchema ()
 
virtual void remove_inactive_columns ()=0
 
virtual void print (bool print_tags=true) const
 
virtual ~HsSchema ()
 
virtual int flush_buffers ()=0
 
virtual int close ()=0
 
virtual int write_event (const time_t t, const char *data, const int data_size)=0
 
virtual int match_event_var (const char *event_name, const char *var_name, const int var_index)
 
virtual int read_last_written (const time_t timestamp, const int debug, time_t *last_written)=0
 
virtual int read_data (const time_t start_time, const time_t end_time, const int num_var, const std::vector< int > &var_schema_index, const int var_index[], const int debug, std::vector< time_t > &last_time, MidasHistoryBufferInterface *buffer[])=0
 

Public Attributes

std::string fEventName
 
time_t fTimeFrom = 0
 
time_t fTimeTo = 0
 
std::vector< HsSchemaEntryfVariables
 
std::vector< intfOffsets
 
int fNumBytes = 0
 
int fCountWriteUndersize = 0
 
int fCountWriteOversize = 0
 
int fWriteMaxSize = 0
 
int fWriteMinSize = 0
 
bool fDisabled = true
 

Detailed Description

Definition at line 402 of file history_schema.cxx.

Constructor & Destructor Documentation

◆ HsSchema()

HsSchema::HsSchema ( )
inline

Definition at line 425 of file history_schema.cxx.

426 {
427 // empty
428 }

◆ ~HsSchema()

HsSchema::~HsSchema ( )
virtual

Definition at line 489 of file history_schema.cxx.

490{
491 // only report if undersize/oversize happens more than once -
492 // the first occurence is already reported by hs_write_event()
493 if (fCountWriteUndersize > 1) {
494 cm_msg(MERROR, "hs_write_event", "Event \'%s\' data size mismatch count: %d, expected %d bytes, hs_write_event() called with as few as %d bytes", fEventName.c_str(), fCountWriteUndersize, fNumBytes, fWriteMinSize);
495 }
496
497 if (fCountWriteOversize > 1) {
498 cm_msg(MERROR, "hs_write_event", "Event \'%s\' data size mismatch count: %d, expected %d bytes, hs_write_event() called with as much as %d bytes", fEventName.c_str(), fCountWriteOversize, fNumBytes, fWriteMaxSize);
499 }
500};
int fCountWriteUndersize
int fCountWriteOversize
std::string fEventName
#define MERROR
Definition midas.h:559
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
Definition midas.cxx:915
Here is the call graph for this function:

Member Function Documentation

◆ close()

virtual int HsSchema::close ( )
pure virtual

Implemented in HsSqlSchema, and HsFileSchema.

◆ flush_buffers()

virtual int HsSchema::flush_buffers ( )
pure virtual

Implemented in HsSqlSchema, and HsFileSchema.

◆ match_event_var()

int HsSchema::match_event_var ( const char event_name,
const char var_name,
const int  var_index 
)
virtual

Reimplemented in HsSqlSchema.

Definition at line 4036 of file history_schema.cxx.

4037{
4038 if (!MatchEventName(this->fEventName.c_str(), event_name))
4039 return -1;
4040
4041 for (unsigned j=0; j<this->fVariables.size(); j++) {
4042 if (MatchTagName(this->fVariables[j].name.c_str(), this->fVariables[j].n_data, var_name, var_index)) {
4043 // Second clause in if() is case where MatchTagName used the "alternate tag name".
4044 // E.g. our variable name is "IM05[3]" (n_data=1), but we're looking for var_name="IM05" and var_index=3.
4045 if (var_index < this->fVariables[j].n_data || (this->fVariables[j].n_data == 1 && this->fVariables[j].name.find("[") != std::string::npos)) {
4046 return j;
4047 }
4048 }
4049 }
4050
4051 return -1;
4052}
std::vector< HsSchemaEntry > fVariables
static bool MatchTagName(const char *tag_name, int n_data, const char *var_tag_name, const int var_tag_index)
static bool MatchEventName(const char *event_name, const char *var_event_name)
#define name(x)
Definition midas_macro.h:24
INT j
Definition odbhist.cxx:40
char var_name[256]
Definition odbhist.cxx:41
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print()

void HsSchema::print ( bool  print_tags = true) const
virtual

Reimplemented in HsSqlSchema, and HsFileSchema.

Definition at line 786 of file history_schema.cxx.

787{
788 unsigned nv = this->fVariables.size();
789 printf("event [%s], time %s..%s, %d variables, %d bytes\n", this->fEventName.c_str(), TimeToString(this->fTimeFrom).c_str(), TimeToString(this->fTimeTo).c_str(), nv, fNumBytes);
790 if (print_tags)
791 for (unsigned j=0; j<nv; j++)
792 printf(" %d: name [%s], type [%s] tid %d, n_data %d, n_bytes %d, offset %d\n", j, this->fVariables[j].name.c_str(), rpc_tid_name(this->fVariables[j].type), this->fVariables[j].type, this->fVariables[j].n_data, this->fVariables[j].n_bytes, this->fOffsets[j]);
793};
std::vector< int > fOffsets
const char * rpc_tid_name(INT id)
Definition midas.cxx:11772
static std::string TimeToString(time_t t)
INT type
Definition mana.cxx:269
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_data()

virtual int HsSchema::read_data ( const time_t  start_time,
const time_t  end_time,
const int  num_var,
const std::vector< int > &  var_schema_index,
const int  var_index[],
const int  debug,
std::vector< time_t > &  last_time,
MidasHistoryBufferInterface buffer[] 
)
pure virtual

Implemented in HsSqlSchema, and HsFileSchema.

Here is the caller graph for this function:

◆ read_last_written()

virtual int HsSchema::read_last_written ( const time_t  timestamp,
const int  debug,
time_t last_written 
)
pure virtual

Implemented in HsSqlSchema, and HsFileSchema.

Here is the caller graph for this function:

◆ remove_inactive_columns()

virtual void HsSchema::remove_inactive_columns ( )
pure virtual

Implemented in HsSqlSchema, and HsFileSchema.

Here is the caller graph for this function:

◆ write_event()

virtual int HsSchema::write_event ( const time_t  t,
const char data,
const int  data_size 
)
pure virtual

Implemented in HsSqlSchema, and HsFileSchema.

Here is the caller graph for this function:

Member Data Documentation

◆ fCountWriteOversize

int HsSchema::fCountWriteOversize = 0

Definition at line 416 of file history_schema.cxx.

◆ fCountWriteUndersize

int HsSchema::fCountWriteUndersize = 0

Definition at line 415 of file history_schema.cxx.

◆ fDisabled

bool HsSchema::fDisabled = true

Definition at line 421 of file history_schema.cxx.

◆ fEventName

std::string HsSchema::fEventName

Definition at line 407 of file history_schema.cxx.

◆ fNumBytes

int HsSchema::fNumBytes = 0

Definition at line 412 of file history_schema.cxx.

◆ fOffsets

std::vector<int> HsSchema::fOffsets

Definition at line 411 of file history_schema.cxx.

◆ fTimeFrom

time_t HsSchema::fTimeFrom = 0

Definition at line 408 of file history_schema.cxx.

◆ fTimeTo

time_t HsSchema::fTimeTo = 0

Definition at line 409 of file history_schema.cxx.

◆ fVariables

std::vector<HsSchemaEntry> HsSchema::fVariables

Definition at line 410 of file history_schema.cxx.

◆ fWriteMaxSize

int HsSchema::fWriteMaxSize = 0

Definition at line 417 of file history_schema.cxx.

◆ fWriteMinSize

int HsSchema::fWriteMinSize = 0

Definition at line 418 of file history_schema.cxx.


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