#ifndef _IHDB_TOOLS_H #define _IHDB_TOOLS_H #include #include #include #include #include #include #include using namespace baosight; using namespace std; class IHDBTools { private: HD3Connection conn; bool m_isconn; HD3PtTagProp normalTag; HD3TimeRegion timeRegion; HD3StRelatedParam stParam; int32 nRecNumQueried; public: IHDBTools(); virtual ~IHDBTools(); public: int ConnectDB(); void DisConnectDB(int retcode); int QuerySnapshot(string tagName, HD3Record *pRec); int QueryByTime(string tagName, HD3TimeRegion *timeRegion, double *fvalue); int QueryByTime(string tagName, time_t start, time_t end, float *value); int ModifyTagProp(string tagName); double StatsTag(string tagName, HD3TimeRegion *timeRegion, short nStatsType); double StatsTag(string tagName, time_t start, time_t end, short nStatsType); int QueryInterpRecordsByMode(string sTagName, HD3_REC_INTERP_QUERY_MODE mode, int size, HD3Record *records); public: HD3_TAG_TYPE GetTagType(string sTagName); int GetDataCount(string sTagName, HD3TimeRegion timeRegion); int GetTagNum(string tagName, time_t start, time_t end); public: int QueryDataByTime(string sTagName, HD3Record *recordsQueried, HD3TimeRegion &m_TimeRegion, int *retNum); int QueryDataByCount(string sTagName, HD3Record *recordsQueried, int *retNum, long long count, HD3TimeRegion m_TimeRegion, bool isAfter); public: int SaveSnapshot(string sTagName, HD3Record *records); private: int GetTagID(string sTagName, HD3_TAG_TYPE tagType = HD3_TAG_TYPE_FLOAT32); private: map m_mptagid; }; #endif