/********************************************************************* * * 文 件: DataAdapter.h 启动文件 * * 版权所有: Shanghai Baosight Software Co., Ltd. *********************************************************************/ #ifndef _H_DATA_ADAPTER_h #define _H_DATA_ADAPTER_h #include #include #include //#include const std::string TAG_HEAD = "ZD122_"; namespace baosight { // const string BR_NAMES[16]={"Power Loss", // "UnderVoltage", // "Motor OL", // "Load Loss", // "InPhaseLoss", // "OutPhaseLoss", // "Dec Inhibit", // "Shear Pin 1", // "Shear Pin 2", // "PriFdbkLoss", // "AltFdbkLoss", // "AuxFdbKLoss", // "PosFdbkLoss", // "Reserved", // "Gnd Warning", // "Reserved"}; // struct BR // { // short event; // short index; // short id; // int count[16]; // }; // // const int BR_ALARM_SIZE = 50; const int STAT_SIZE = 10000; struct STAT { int count; double sum; double avg; double max; double min; double std_dev; double zonetop; double zonelow; char tag[100]; char comment[100]; }; typedef STAT STATS[STAT_SIZE]; class DataAdapter { public: DataAdapter(); ~DataAdapter(); public: int Init(); int push(const string& tag, double value); int push(int index, double value); int calcAverage(void); int calcAverage(const string& tag); int calcDevZone(time_t start,time_t end); int calcDevZone(const string& tag, time_t start,time_t end); int calcLimitZone(time_t start,time_t end); int calcLimitZone(const string& tag, time_t start,time_t end); STAT* getValue(const string& tag); STAT* getValue(int index); void print(int index); // int BRAlarm(void); private: // int BRAlarmStoreDB(int index,const string& item,const string& chinese,int count); private: BinaryTele* mp_btele; STATS* mp_stats; map mp_tags; // map mp_brs; ReadIHDB* mp_read; // ProducerMQ* mp_producer; }; } #endif