OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
ast.hpp
Go to the documentation of this file.
1 //
2 // Copyright & License: See Copyright.readme in src directory
3 //
4 
9 #ifndef AST_HPP_
10 #define AST_HPP_
11 
12 #include <boost/variant.hpp>
13 #include <boost/spirit/include/qi.hpp>
14 
15 #include <string>
16 #include <vector>
17 
18 namespace SDDS {
19  namespace ast {
20  enum datatype { FLOAT
23  , LONG
25  , STRING };
26 
27  enum datamode { ASCII
28  , BINARY};
29 
32 
33  struct nil {};
34 
35  typedef boost::variant<float,
36  double,
37  short,
38  long,
39  char,
40  std::string> variant_t;
41 
42  typedef std::vector<variant_t> columnData_t;
43 
44  inline
46  switch(type) {
47  case FLOAT:
48  return "float";
49  case DOUBLE:
50  return "double";
51  case SHORT:
52  return "short";
53  case LONG:
54  return "long";
55  case CHARACTER:
56  return "char";
57  case STRING:
58  return "string";
59  default:
60  return "unknown";
61  }
62  }
63 
64  }
65 
66  namespace parser {
67  namespace qi = boost::spirit::qi;
68 
69  template <typename Iterator, typename Skipper>
70  struct string: qi::grammar<Iterator, std::string(), Skipper >
71  {
72  string();
73 
74  boost::spirit::qi::rule<Iterator, std::string(), Skipper> start;
75  };
76 
77  template <typename Iterator, typename Skipper>
78  struct qstring: qi::grammar<Iterator, std::string(), Skipper >
79  {
80  qstring();
81 
82  boost::spirit::qi::rule<Iterator, std::string(), Skipper> start;
83  };
84 }
85 }
86 
87 #endif // AST_HPP_
boost::variant< float, double, short, long, char, std::string > variant_t
Definition: ast.hpp:40
std::vector< variant_t > columnData_t
Definition: ast.hpp:42
std::string getDataTypeString(datatype type)
Definition: ast.hpp:45
endianess
Definition: ast.hpp:30
boost::spirit::qi::rule< Iterator, std::string(), Skipper > start
Definition: ast.hpp:74
boost::spirit::qi::rule< Iterator, std::string(), Skipper > start
Definition: ast.hpp:82
datamode
Definition: ast.hpp:27
datatype
Definition: ast.hpp:20