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< int > fOffsets
 
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 403 of file history_schema.cxx.

Constructor & Destructor Documentation

◆ HsSchema()

HsSchema::HsSchema ( )
inline

Definition at line 426 of file history_schema.cxx.

427 {
428 // empty
429 }

◆ ~HsSchema()

HsSchema::~HsSchema ( )
virtual

Definition at line 490 of file history_schema.cxx.

491{
492 //printf("HsSchema::dtor %p!\n", this);
493 // only report if undersize/oversize happens more than once -
494 // the first occurence is already reported by hs_write_event()
495 if (fCountWriteUndersize > 1) {
496 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);
497 }
498
499 if (fCountWriteOversize > 1) {
500 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);
501 }
502};
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:931
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 4149 of file history_schema.cxx.

4150{
4151 if (!MatchEventName(this->fEventName.c_str(), event_name))
4152 return -1;
4153
4154 for (size_t j=0; j<this->fVariables.size(); j++) {
4155 if (MatchTagName(this->fVariables[j].name.c_str(), this->fVariables[j].n_data, var_name, var_index)) {
4156 // Second clause in if() is case where MatchTagName used the "alternate tag name".
4157 // E.g. our variable name is "IM05[3]" (n_data=1), but we're looking for var_name="IM05" and var_index=3.
4158 if (var_index < this->fVariables[j].n_data || (this->fVariables[j].n_data == 1 && this->fVariables[j].name.find("[") != std::string::npos)) {
4159 return j;
4160 }
4161 }
4162 }
4163
4164 return -1;
4165}
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
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 815 of file history_schema.cxx.

816{
817 size_t nv = this->fVariables.size();
818 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);
819 if (print_tags)
820 for (size_t j=0; j<nv; j++)
821 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]);
822};
std::vector< int > fOffsets
const char * rpc_tid_name(INT id)
Definition midas.cxx:11895
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 417 of file history_schema.cxx.

◆ fCountWriteUndersize

int HsSchema::fCountWriteUndersize = 0

Definition at line 416 of file history_schema.cxx.

◆ fDisabled

bool HsSchema::fDisabled = true

Definition at line 422 of file history_schema.cxx.

◆ fEventName

std::string HsSchema::fEventName

Definition at line 408 of file history_schema.cxx.

◆ fNumBytes

size_t HsSchema::fNumBytes = 0

Definition at line 413 of file history_schema.cxx.

◆ fOffsets

std::vector<int> HsSchema::fOffsets

Definition at line 412 of file history_schema.cxx.

◆ fTimeFrom

time_t HsSchema::fTimeFrom = 0

Definition at line 409 of file history_schema.cxx.

◆ fTimeTo

time_t HsSchema::fTimeTo = 0

Definition at line 410 of file history_schema.cxx.

◆ fVariables

std::vector<HsSchemaEntry> HsSchema::fVariables

Definition at line 411 of file history_schema.cxx.

◆ fWriteMaxSize

size_t HsSchema::fWriteMaxSize = 0

Definition at line 418 of file history_schema.cxx.

◆ fWriteMinSize

size_t HsSchema::fWriteMinSize = 0

Definition at line 419 of file history_schema.cxx.


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