Midas C++ API - hs_xxx functions
This page contains the full API reference for the hs_xxx history functions, and for MidasHistoryInterface, the class used to read and write the history (history.h).
For the concepts and day-to-day use, see History: overview.
For explanations and examples of reading history data from code, see History: programming.
Midas History Functions (hs_xxx)
Functions
hs_define_panel
int hs_define_panel(const char *group, const char *panel, const std::vector<std::string> vars)
define history panel
Declared in include/history.h:53, defined in src/history.cxx:3482
hs_define_panel2
INT hs_define_panel2(const char *group, const char *panel, const std::vector<std::string> var, const std::vector<std::string> label, const std::vector<std::string> formula = {}, const std::vector<std::string> color = {})
Declared in include/history.h:54, defined in src/history.cxx:3522
Creating a MidasHistoryInterface
hs_get_history() creates the history interface defined by a history channel in /Logger/History. hs_find_reader_channel() finds the channel to read from. The MakeMidasHistoryXXX() functions create an interface for one kind of history storage directly.
hs_get_history
int hs_get_history(HNDLE hDB, HNDLE hKey, int flags, int debug_flag, MidasHistoryInterface **mh)
construct history interface class from logger history channel definition in /Logger/History/0/...
Declared in include/history.h:41, defined in src/history_common.cxx:22
HS_GET_READER
#define HS_GET_READER 1
Defined in include/history.h:35
HS_GET_WRITER
#define HS_GET_WRITER 2
Defined in include/history.h:36
HS_GET_INACTIVE
#define HS_GET_INACTIVE 4
Defined in include/history.h:37
HS_GET_DEFAULT
#define HS_GET_DEFAULT 8
Defined in include/history.h:38
hs_find_reader_channel
int hs_find_reader_channel(HNDLE hDB, HNDLE* hKey, int debug_flag)
find history reader channel, returns ODB handle to the history channel definition in /Logger/History/...
Declared in include/history.h:44, defined in src/history_common.cxx:337
MakeMidasHistory
MidasHistoryInterface*MakeMidasHistory()
Declared in include/history.h:27, defined in src/history.cxx:3577
MakeMidasHistoryFile
MidasHistoryInterface*MakeMidasHistoryFile()
Declared in include/history.h:33, defined in src/history_schema.cxx:7296
MakeMidasHistoryMysql
MidasHistoryInterface*MakeMidasHistoryMysql()
Declared in include/history.h:31, defined in src/history_schema.cxx:7276
MakeMidasHistoryPgsql
MidasHistoryInterface*MakeMidasHistoryPgsql()
Declared in include/history.h:32, defined in src/history_schema.cxx:7286
MakeMidasHistorySqlite
MidasHistoryInterface*MakeMidasHistorySqlite()
Declared in include/history.h:29, defined in src/history_schema.cxx:7266
MakeMidasHistoryODBC
MidasHistoryInterface*MakeMidasHistoryODBC()
Declared in include/history.h:28, defined in src/history_odbc.cxx:2150
MakeMidasHistorySqlDebug
MidasHistoryInterface*MakeMidasHistorySqlDebug()
Declared in include/history.h:30, defined in src/history_odbc.cxx:2156
The MidasHistoryInterface class
MidasHistoryInterface
Defined in include/history.h:108
Methods
hs_clear_cache
virtualpure virtual
virtual int hs_clear_cache() = 0
clear internal cache, returns HS_SUCCESS
Defined in include/history.h:129
hs_connect
virtualpure virtual
virtual int hs_connect(const char* connect_string) = 0
returns HS_SUCCESS
Defined in include/history.h:124
hs_define_event
virtualpure virtual
virtual int hs_define_event(const char* event_name, time_t timestamp, int ntags, const TAG tags[]) = 0
see hs_define_event(), returns HS_SUCCESS or HS_FILE_ERROR
Defined in include/history.h:133
hs_disconnect
virtualpure virtual
virtual int hs_disconnect() = 0
disconnect from history, returns HS_SUCCESS
Defined in include/history.h:125
hs_flush_buffers
virtualpure virtual
virtual int hs_flush_buffers() = 0
flush buffered data to storage where it is visible to mhttpd
Defined in include/history.h:137
hs_get_events
virtualpure virtual
virtual int hs_get_events(time_t time_from, std::vector<std::string> *pevents) = 0
get list of events that exist(ed) at given time and later (value 0 means "return all events from beginning of time"), returns HS_SUCCESS
Defined in include/history.h:141
hs_get_last_written
virtualpure virtual
virtual int hs_get_last_written(time_t start_time, int num_var, const char* const event_name[], const char* const tag_name[], const int var_index[], time_t last_written[]) = 0
Defined in include/history.h:145
hs_get_tags
virtualpure virtual
virtual int hs_get_tags(const char* event_name, time_t time_from, std::vector<TAG> *ptags) = 0
get list of history variables for given event (use event names returned by hs_get_events()) that exist(ed) at given time and later (value 0 means "all variables for this event that ever existed"), also see hs_get_tags(), returns HS_SUCCESS
Defined in include/history.h:143
hs_read
virtualpure virtual
virtual int hs_read(time_t start_time, time_t end_time, time_t interval, int num_var, const char* const event_name[], const char* const tag_name[], const int var_index[], int num_entries[], time_t* time_buffer[], double* data_buffer[], int status[]) = 0
see hs_read(), returns HS_SUCCESS
Defined in include/history.h:154
hs_read_binned
virtualpure virtual
virtual int hs_read_binned(time_t start_time, time_t end_time, int num_bins, int num_var, const char* const event_name[], const char* const tag_name[], const int var_index[], int num_entries[], int* count_bins[], double* mean_bins[], double* rms_bins[], double* min_bins[], double* max_bins[], time_t* bins_first_time[], double* bins_first_value[], time_t* bins_last_time[], double* bins_last_value[], time_t last_time[], double last_value[], int status[]) = 0
returns HS_SUCCESS
Defined in include/history.h:159
hs_read_buffer
virtualpure virtual
virtual int hs_read_buffer(time_t start_time, time_t end_time, int num_var, const char* const event_name[], const char* const tag_name[], const int var_index[], MidasHistoryBufferInterface* buffer[], int status[]) = 0
returns HS_SUCCESS
Defined in include/history.h:149
hs_set_debug
virtualpure virtual
virtual int hs_set_debug(int debug) = 0
set debug level, returns previous debug level
Defined in include/history.h:127
hs_write_event
virtualpure virtual
virtual int hs_write_event(const char* event_name, time_t timestamp, int data_size, const char* data) = 0
see hs_write_event(), returns HS_SUCCESS or HS_FILE_ERROR
Defined in include/history.h:135
MidasHistoryInterface
MidasHistoryInterface()
history type: MIDAS, ODBC, SQLITE, etc
Defined in include/history.h:115
~MidasHistoryInterface
virtual
virtual ~MidasHistoryInterface()
Defined in include/history.h:121
Attributes
name
char name[NAME_LENGTH]
Defined in include/history.h:111
type
char type[NAME_LENGTH]
history channel name
Defined in include/history.h:112
Buffers for reading history data
hs_read_buffer() passes the data it reads to objects derived from MidasHistoryBufferInterface. MidasHistoryBinnedBuffer is one of them: it sorts the data into time bins, and is used by hs_read_binned().
MidasHistoryBufferInterface
Defined in include/history.h:60
Methods
Add
virtualpure virtual
virtual void Add(time_t time, double value) = 0
Defined in include/history.h:66
MidasHistoryBufferInterface
MidasHistoryBufferInterface()
Defined in include/history.h:63
~MidasHistoryBufferInterface
virtual
virtual ~MidasHistoryBufferInterface()
Defined in include/history.h:64
MidasHistoryBinnedBuffer
class MidasHistoryBinnedBuffer : public MidasHistoryBufferInterface
Defined in include/history.h:69
Methods
Add
void Add(time_t t, double v)
Declared in include/history.h:102, defined in src/history_schema.cxx:3396
Finish
void Finish()
Declared in include/history.h:103, defined in src/history_schema.cxx:3461
MidasHistoryBinnedBuffer
MidasHistoryBinnedBuffer(time_t first_time, time_t last_time, int num_bins)
ctor
Declared in include/history.h:97, defined in src/history_schema.cxx:3336
Start
void Start()
Declared in include/history.h:101, defined in src/history_schema.cxx:3374
~MidasHistoryBinnedBuffer
~MidasHistoryBinnedBuffer()
dtor
Declared in include/history.h:98, defined in src/history_schema.cxx:3355
Attributes
fBinsFirstTime
time_t *fBinsFirstTime = NULL
Defined in include/history.h:88
fBinsFirstValue
double *fBinsFirstValue = NULL
Defined in include/history.h:89
fBinsLastTime
time_t *fBinsLastTime = NULL
Defined in include/history.h:90
fBinsLastValue
double *fBinsLastValue = NULL
Defined in include/history.h:91
fCount
int *fCount = NULL
following arrays are owned by the caller of hs_read_binned()
Defined in include/history.h:82
fFirstTime
time_t fFirstTime = 0
Defined in include/history.h:73
fLastTime
time_t fLastTime = 0
Defined in include/history.h:74
fLastTimePtr
time_t *fLastTimePtr = NULL
Defined in include/history.h:93
fLastValuePtr
double *fLastValuePtr = NULL
Defined in include/history.h:94
fMax
double *fMax = NULL
Defined in include/history.h:86
fMean
double *fMean = NULL
Defined in include/history.h:83
fMin
double *fMin = NULL
Defined in include/history.h:85
fNumBins
int fNumBins = 0
Defined in include/history.h:72
fNumEntries
int fNumEntries = 0
Defined in include/history.h:76
fRms
double *fRms = NULL
Defined in include/history.h:84
fSum0
double *fSum0 = NULL
Defined in include/history.h:77
fSum1
double *fSum1 = NULL
Defined in include/history.h:78
fSum2
double *fSum2 = NULL
Defined in include/history.h:79
Other history functions
hs_save_event_list
int hs_save_event_list(const std::vector<std::string> *pevents)
save list of active events
Declared in include/history.h:47, defined in src/history_common.cxx:396
hs_read_event_list
int hs_read_event_list(std::vector<std::string> *pevents)
get list of active events
Declared in include/history.h:50, defined in src/history_common.cxx:426
hs_image_retrieve
int hs_image_retrieve(std::string image_name, time_t start, time_t stop, std::vector<time_t> &vtime, std::vector<std::string> &vfilename)
retrieve image history
Declared in include/midas.h:2130, defined in src/history_image.cxx:332