Fledge
An open source edge computing platform for industrial users
sort.h
1 #ifndef _SORT_H
2 #define _SORT_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 Sort {
21  public:
22  Sort(const std::string& column) :
23  m_column(column), m_reverse(false) {};
24  Sort(const std::string& column, bool reverse) :
25  m_column(column), m_reverse(reverse) {};
26  ~Sort() {};
27  std::string toJSON()
28  {
29  std::ostringstream json;
30 
31  json << "{ \"column\" : \"" << m_column << "\", ";
32  json << "\"direction\" : \"" << (m_reverse ? "desc" : "asc") << "\" }";
33  return json.str();
34  }
35  private:
36  const std::string m_column;
37  bool m_reverse;
38 };
39 #endif
40 
Sort clause in a selection of records.
Definition: sort.h:20