history.h

Go to the documentation of this file.
00001 /********************************************************************\
00002 
00003   Name:         history.h
00004   Created by:   Konstantin Olchanski / TRIUMF
00005 
00006   Contents:     Interface for the MIDAS history system
00007 
00008   $Id$
00009 
00010 \********************************************************************/
00011 
00012 #ifndef HISTORY_H
00013 #define HISTORY_H
00014 
00015 #include <string>
00016 #include <vector>
00017 
00018 /// \file history.h
00019 ///
00020 
00021 class MidasHistoryInterface;
00022 class MidasSqlInterface;
00023 
00024 // "factory" pattern
00025 
00026 MidasHistoryInterface* MakeMidasHistory();
00027 MidasHistoryInterface* MakeMidasHistoryODBC();
00028 MidasHistoryInterface* MakeMidasHistorySqlDebug();
00029 
00030 // MIDAS history interface class
00031 
00032 class MidasHistoryInterface
00033 {
00034  public:
00035   virtual ~MidasHistoryInterface() { };
00036 
00037  public:
00038   virtual int hs_connect(const char* connect_string) = 0; ///< returns HS_SUCCESS
00039   virtual int hs_disconnect() = 0;                  ///< disconnect from history, returns HS_SUCCESS
00040 
00041   virtual int hs_set_debug(int debug) = 0;          ///< set debug level, returns previous debug level
00042 
00043   virtual int hs_clear_cache() = 0; ///< clear internal cache, returns HS_SUCCESS
00044 
00045   // functions for writing into the history, used by mlogger
00046 
00047   virtual int hs_define_event(const char* event_name, int ntags, const TAG tags[]) = 0; ///< see hs_define_event(), returns HS_SUCCESS or HS_FILE_ERROR
00048 
00049   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
00050 
00051   // functions for reading from the history, used by mhttpd, mhist
00052 
00053   virtual int hs_get_events(std::vector<std::string> *pevents) = 0; ///< get list of all events, returns HS_SUCCESS
00054 
00055   virtual int hs_get_tags(const char* event_name, std::vector<TAG> *ptags) = 0; ///< use event names returned by hs_get_events_odbc(), see hs_get_tags(), returns HS_SUCCESS
00056 
00057   virtual int hs_read(time_t start_time, time_t end_time, time_t interval,
00058                  int num_var,
00059                  const char* event_name[], const char* tag_name[], const int var_index[],
00060                  int num_entries[],
00061                  time_t* time_buffer[], double* data_buffer[],
00062                  int status[]) = 0; ///< see hs_read(), returns HS_SUCCESS
00063 };
00064 
00065 #endif
00066 // end

Midas DOC Version 3.0.0 ---- PSI Stefan Ritt ----
Contributions: Pierre-Andre Amaudruz - Sergio Ballestrero - Suzannah Daviel - Doxygen - Peter Green - Qing Gu - Greg Hackman - Gertjan Hofman - Paul Knowles - Exaos Lee - Rudi Meier - Glenn Moloney - Dave Morris - John M O'Donnell - Konstantin Olchanski - Renee Poutissou - Tamsen Schurman - Andreas Suter - Jan M.Wouters - Piotr Adam Zolnierczuk