query.h 2.3 KB
Newer Older
Axel Auweter's avatar
Axel Auweter committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//================================================================================
// Name        : query.h
// Author      : Axel Auweter
// Copyright   : Leibniz Supercomputing Centre
// Description : Header of query class of dcdbquery
//================================================================================

//================================================================================
// This file is part of DCDB (DataCenter DataBase)
// Copyright (C) 2011-2016 Leibniz Supercomputing Centre
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//================================================================================

Axel Auweter's avatar
Axel Auweter committed
27
28
29
30

#include <list>
#include <string>

Axel Auweter's avatar
Axel Auweter committed
31
#include "dcdb/connection.h"
Axel Auweter's avatar
Axel Auweter committed
32
#include "dcdb/timestamp.h"
Axel Auweter's avatar
Axel Auweter committed
33
#include "dcdb/sensorid.h"
Axel Auweter's avatar
Axel Auweter committed
34
#include "dcdb/sensordatastore.h"
Axel Auweter's avatar
Axel Auweter committed
35
#include "dcdb/sensorconfig.h"
Axel Auweter's avatar
Axel Auweter committed
36
#include "dcdb/unitconv.h"
37
#include "dcdb/virtualsensor.h"
38
#include "dcdb/sensor.h"
Axel Auweter's avatar
Axel Auweter committed
39
40
41
42
43
44

#ifndef QUERY_H
#define QUERY_H

class DCDBQuery
{
Axel Auweter's avatar
Axel Auweter committed
45
protected:
46
  DCDB::Connection* connection;
Axel Auweter's avatar
Axel Auweter committed
47
48
  bool useLocalTime;
  bool useRawOutput;
Axel Auweter's avatar
Axel Auweter committed
49
  bool useFloatOutput;
Axel Auweter's avatar
Axel Auweter committed
50

51
52
53
54
55
56
57
  std::string sensorName;
  bool scale;
  double scalingFactor;
  bool unitConvert;
  DCDB::Unit baseUnit;
  DCDB::Unit targetUnit;

Axel Auweter's avatar
Axel Auweter committed
58
public:
Axel Auweter's avatar
Axel Auweter committed
59
60
61
62
  void setLocalTimeEnabled(bool enable);
  bool getLocalTimeEnabled();
  void setRawOutputEnabled(bool enable);
  bool getRawOutputEnabled();
Axel Auweter's avatar
Axel Auweter committed
63
64
  void setFloatOutputEnabled(bool enable);
  bool getFloatOutputEnabled();
65

66
  void genOutput(std::list<DCDB::SensorDataStoreReading> &results);
67

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

Axel Auweter's avatar
Axel Auweter committed
70
  DCDBQuery();
Axel Auweter's avatar
Axel Auweter committed
71
  virtual ~DCDBQuery() {};
Axel Auweter's avatar
Axel Auweter committed
72
73
74
75
76

};


#endif /* QUERY_H */