Fledge
An open source edge computing platform for industrial users
timebucket.h
1 #ifndef _TIMEBUCKET_H
2 #define _TIMEBUCKET_H
3 /*
4  * Fledge storage client.
5  *
6  * Copyright (c) 2018 OSisoft, LLC
7  *
8  * Released under the Apache 2.0 Licence
9  *
10  * Author: Mark Riddoch
11  */
12 #include <string>
13 #include <sstream>
14 #include <iostream>
15 
16 
20 class Timebucket {
21  public:
22  Timebucket(const std::string& column, unsigned int size,
23  const std::string& format, const std::string& alias) :
24  m_column(column), m_size(size), m_format(format), m_alias(alias) {};
25  Timebucket(const std::string& column, unsigned int size,
26  const std::string& format) :
27  m_column(column), m_size(size), m_format(format), m_alias(column) {};
28  ~Timebucket() {};
29  std::string toJSON()
30  {
31  std::ostringstream json;
32 
33  json << "{ \"timestamp\" : \"" << m_column << "\", ";
34  json << "\"size\" : \"" << m_size << "\", ";
35  json << "\"format\" : \"" << m_format << "\", ";
36  json << "\"alias\" : \"" << m_alias << "\" }";
37  return json.str();
38  }
39  private:
40  const std::string m_column;
41  unsigned int m_size;
42  const std::string m_format;
43  const std::string m_alias;
44 };
45 #endif
46 
Timebucket clause in a selection of records.
Definition: timebucket.h:20