query.h 1.09 KB
Newer Older
Axel Auweter's avatar
Axel Auweter committed
1
2
3
4
5
6
7
8
9
10
/*
 * query.cpp
 *
 *  Created on: Feb 20, 2015
 *      Author: Axel Auweter
 */

#include <list>
#include <string>

Axel Auweter's avatar
Axel Auweter committed
11
#include "dcdb/connection.h"
Axel Auweter's avatar
Axel Auweter committed
12
#include "dcdb/timestamp.h"
Axel Auweter's avatar
Axel Auweter committed
13
#include "dcdb/sensorid.h"
Axel Auweter's avatar
Axel Auweter committed
14
#include "dcdb/sensordatastore.h"
Axel Auweter's avatar
Axel Auweter committed
15
#include "dcdb/sensorconfig.h"
Axel Auweter's avatar
Axel Auweter committed
16
#include "dcdb/unitconv.h"
17
#include "dcdb/virtualsensor.h"
Axel Auweter's avatar
Axel Auweter committed
18
19
20
21
22
23

#ifndef QUERY_H
#define QUERY_H

class DCDBQuery
{
Axel Auweter's avatar
Axel Auweter committed
24
protected:
25
  DCDB::Connection* connection;
Axel Auweter's avatar
Axel Auweter committed
26
27
  bool useLocalTime;
  bool useRawOutput;
Axel Auweter's avatar
Axel Auweter committed
28
  bool useFloatOutput;
Axel Auweter's avatar
Axel Auweter committed
29

Axel Auweter's avatar
Axel Auweter committed
30
public:
Axel Auweter's avatar
Axel Auweter committed
31
32
33
34
  void setLocalTimeEnabled(bool enable);
  bool getLocalTimeEnabled();
  void setRawOutputEnabled(bool enable);
  bool getRawOutputEnabled();
Axel Auweter's avatar
Axel Auweter committed
35
36
  void setFloatOutputEnabled(bool enable);
  bool getFloatOutputEnabled();
37
38
39
40
41
42
43
44
45
46
47

  void genOutput(
      std::string sensor,
      DCDB::SensorDataStoreReading& reading,
      bool scale,
      double scalingFactor,
      bool unitConvert,
      DCDB::Unit baseUnit,
      DCDB::Unit targetUnit
      );

48
  void doQuery(const char* hostname, std::list<std::string> sensors, DCDB::TimeStamp start, DCDB::TimeStamp end);
Axel Auweter's avatar
Axel Auweter committed
49

Axel Auweter's avatar
Axel Auweter committed
50
  DCDBQuery();
Axel Auweter's avatar
Axel Auweter committed
51
  virtual ~DCDBQuery() {};
Axel Auweter's avatar
Axel Auweter committed
52
53
54
55
56

};


#endif /* QUERY_H */