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 size_t 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
 
size_t fNumBytes = 0
 
int fCountWriteUndersize = 0
 
int fCountWriteOversize = 0
 
size_t fWriteMaxSize = 0
 
size_t 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 //printf("HsSchema::dtor %p!\n", this);
492 // only report if undersize/oversize happens more than once -
493 // the first occurence is already reported by hs_write_event()
494 if (fCountWriteUndersize > 1) {
495 cm_msg(MERROR, "hs_write_event", "Event \'%s\' data size mismatch count: %d, expected %zu bytes, hs_write_event() called with as few as %zu bytes", fEventName.c_str(), fCountWriteUndersize, fNumBytes, fWriteMinSize);
496 }
497
498 if (fCountWriteOversize > 1) {
499 cm_msg(MERROR, "hs_write_event", "Event \'%s\' data size mismatch count: %d, expected %zu bytes, hs_write_event() called with as many as %zu bytes", fEventName.c_str(), fCountWriteOversize, fNumBytes, fWriteMaxSize);
500 }
501};
int fCountWriteUndersize
size_t fWriteMinSize
int fCountWriteOversize
size_t fWriteMaxSize
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:929
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 4126 of file history_schema.cxx.

4127{
4128 if (!MatchEventName(this->fEventName.c_str(), event_name))
4129 return -1;
4130
4131 for (size_t j=0; j<this->fVariables.size(); j++) {
4132 if (MatchTagName(this->fVariables[j].name.c_str(), this->fVariables[j].n_data, var_name, var_index)) {
4133 // Second clause in if() is case where MatchTagName used the "alternate tag name".
4134 // E.g. our variable name is "IM05[3]" (n_data=1), but we're looking for var_name="IM05" and var_index=3.
4135 if (var_index < this->fVariables[j].n_data || (this->fVariables[j].n_data == 1 && this->fVariables[j].name.find("[") != std::string::npos)) {
4136 return j;
4137 }
4138 }
4139 }
4140
4141 return -1;
4142}
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 792 of file history_schema.cxx.

793{
794 size_t nv = this->fVariables.size();
795 printf("event [%s], time %s..%s, %zu variables, %zu bytes\n", this->fEventName.c_str(), TimeToString(this->fTimeFrom).c_str(), TimeToString(this->fTimeTo).c_str(), nv, fNumBytes);
796 if (print_tags)
797 for (size_t j=0; j<nv; j++)
798 printf(" %zu: 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]);
799};
std::vector< int > fOffsets
const char * rpc_tid_name(INT id)
Definition midas.cxx:11786
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 size_t  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

size_t 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

size_t HsSchema::fWriteMaxSize = 0

Definition at line 417 of file history_schema.cxx.

◆ fWriteMinSize

size_t HsSchema::fWriteMinSize = 0

Definition at line 418 of file history_schema.cxx.


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