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

Public Member Functions

 HsSchema ()
 
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 event_name
 
time_t time_from = 0
 
time_t time_to = 0
 
std::vector< HsSchemaEntryvariables
 
std::vector< intoffsets
 
int n_bytes = 0
 
int count_write_undersize = 0
 
int count_write_oversize = 0
 
int write_max_size = 0
 
int write_min_size = 0
 
bool disabled = true
 

Detailed Description

Definition at line 410 of file history_schema.cxx.

Constructor & Destructor Documentation

◆ HsSchema()

HsSchema::HsSchema ( )
inline

Definition at line 429 of file history_schema.cxx.

430 {
431 time_from = 0;
432 time_to = 0;
433 n_bytes = 0;
434
437 write_max_size = 0;
438 write_min_size = 0;
439 }
int count_write_undersize
int count_write_oversize

◆ ~HsSchema()

HsSchema::~HsSchema ( )
virtual

Definition at line 499 of file history_schema.cxx.

500{
501 // only report if undersize/oversize happens more than once -
502 // the first occurence is already reported by hs_write_event()
503 if (count_write_undersize > 1) {
504 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", event_name.c_str(), count_write_undersize, n_bytes, write_min_size);
505 }
506
507 if (count_write_oversize > 1) {
508 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", event_name.c_str(), count_write_oversize, n_bytes, write_max_size);
509 }
510};
#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
std::string event_name
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 4041 of file history_schema.cxx.

4042{
4043 if (!MatchEventName(this->event_name.c_str(), event_name))
4044 return -1;
4045
4046 for (unsigned j=0; j<this->variables.size(); j++) {
4047 if (MatchTagName(this->variables[j].name.c_str(), this->variables[j].n_data, var_name, var_index)) {
4048 // Second clause in if() is case where MatchTagName used the "alternate tag name".
4049 // E.g. our variable name is "IM05[3]" (n_data=1), but we're looking for var_name="IM05" and var_index=3.
4050 if (var_index < this->variables[j].n_data || (this->variables[j].n_data == 1 && this->variables[j].name.find("[") != std::string::npos)) {
4051 return j;
4052 }
4053 }
4054 }
4055
4056 return -1;
4057}
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
std::vector< HsSchemaEntry > variables
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 788 of file history_schema.cxx.

789{
790 unsigned nv = this->variables.size();
791 printf("event [%s], time %s..%s, %d variables, %d bytes\n", this->event_name.c_str(), TimeToString(this->time_from).c_str(), TimeToString(this->time_to).c_str(), nv, n_bytes);
792 if (print_tags)
793 for (unsigned j=0; j<nv; j++)
794 printf(" %d: name [%s], type [%s] tid %d, n_data %d, n_bytes %d, offset %d\n", j, this->variables[j].name.c_str(), rpc_tid_name(this->variables[j].type), this->variables[j].type, this->variables[j].n_data, this->variables[j].n_bytes, this->offsets[j]);
795};
const char * rpc_tid_name(INT id)
Definition midas.cxx:11764
static std::string TimeToString(time_t t)
INT type
Definition mana.cxx:269
std::vector< int > offsets
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:

◆ 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

◆ count_write_oversize

int HsSchema::count_write_oversize = 0

Definition at line 422 of file history_schema.cxx.

◆ count_write_undersize

int HsSchema::count_write_undersize = 0

Definition at line 421 of file history_schema.cxx.

◆ disabled

bool HsSchema::disabled = true

Definition at line 427 of file history_schema.cxx.

◆ event_name

std::string HsSchema::event_name

Definition at line 413 of file history_schema.cxx.

◆ n_bytes

int HsSchema::n_bytes = 0

Definition at line 418 of file history_schema.cxx.

◆ offsets

std::vector<int> HsSchema::offsets

Definition at line 417 of file history_schema.cxx.

◆ time_from

time_t HsSchema::time_from = 0

Definition at line 414 of file history_schema.cxx.

◆ time_to

time_t HsSchema::time_to = 0

Definition at line 415 of file history_schema.cxx.

◆ variables

std::vector<HsSchemaEntry> HsSchema::variables

Definition at line 416 of file history_schema.cxx.

◆ write_max_size

int HsSchema::write_max_size = 0

Definition at line 423 of file history_schema.cxx.

◆ write_min_size

int HsSchema::write_min_size = 0

Definition at line 424 of file history_schema.cxx.


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