| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #ifndef DATAINTERFACE_DATACONDENSER_H
- #define DATAINTERFACE_DATACONDENSER_H
- #include "DataType.h"
- #include "RRA.h"
- #include <MySQLClient.h>
- #include <string>
- #include <vector>
- namespace DataStorageInterface {
- namespace DataInterface {
- class DataCondenser
- {
- public:
- DataCondenser(MySQL::MySQLClient* pMySQLClient);
- void CondenseData();
- private:
- int GetPeriodStamp(int timestamp, const RRA::type& rra);
- std::vector<int> GetDeviceIDs();
- int GetNewestPeriodStamp(const std::string& sourceTable, int deviceId, int dataId);
- MySQL::MySQLResultSet GetRawData(const std::string& sourceTable, int deviceId, int dataId, int newestPeriodStamp);
- MySQL::MySQLResultSet GetReducedData(const std::string& sourceTable, int deviceId, int dataId, int newestPeriodStamp);
- int GetMaximumMySQLPacketSize();
- DataType::type GetDataType(int deviceId, int dataId);
- std::string GetSourceTable(const RRA::type& rra);
- std::string GetDestinationTable(const RRA::type& rra);
- int StringStreamSize(std::stringstream& ss);
- void InitializeInsertQuery(std::stringstream& query, const std::string& table);
- void ExecuteInsertQuery(std::stringstream& query);
- void WriteReducedFloatData(int deviceId, int dataId, const RRA::type& rra);
- void WriteReducedStringData(int deviceId, int dataId, const RRA::type& rra);
- void WriteReducedData(int deviceId, int dataId, const RRA::type& rra);
- void CleanData();
- void CleanData(const RRA::type& rra);
- private:
- MySQL::MySQLClient* m_pMySQLClient;
- };
- } // namespace DataInterface
- } // namespace DataStorageInterface
- #endif // DATAINTERFACE_DATACONDENSER_H
|