libpniio
spirit_rules.hpp
Go to the documentation of this file.
1 //
2 // (c) Copyright 2014 DESY, Eugen Wintersberger <eugen.wintersberger@desy.de>
3 //
4 // This file is part of libpniio.
5 //
6 // libpniio is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // libpniio is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with libpniio. If not, see <http://www.gnu.org/licenses/>.
18 // ===========================================================================
19 //
20 // Created on: Dec 3, 2014
21 // Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
22 //
23 //
24 #pragma once
25 
26 #include <pni/core/types.hpp>
27 #include <boost/mpl/map.hpp>
28 #include <boost/spirit/include/qi_real.hpp>
29 #include <boost/spirit/include/qi_uint.hpp>
30 #include <boost/spirit/include/qi_int.hpp>
31 
32 namespace pni{
33 namespace io{
34 
35 #define PARSER_TYPE(p)\
36  std::remove_const<decltype(p)>::type
37 
45  typedef boost::mpl::map<
46  boost::mpl::pair<
47  pni::core::uint8 ,
48  boost::spirit::qi::uint_parser<pni::core::uint8,
49  10,1,4>
50  >,
51 
52  boost::mpl::pair<pni::core::uint16,
53  PARSER_TYPE(boost::spirit::qi::ushort_)
54  >,
55 
56  boost::mpl::pair<
57  pni::core::uint32,
58  PARSER_TYPE(boost::spirit::qi::uint_)
59  >,
60 
61  boost::mpl::pair<
62  pni::core::uint64,
63  PARSER_TYPE(boost::spirit::qi::ulong_)
64  >,
65  boost::mpl::pair<
66  pni::core::int8 ,
67  boost::spirit::qi::uint_parser<pni::core::int8,
68  10,1,4>
69  >,
70 
71  boost::mpl::pair<
72  pni::core::int16,
73  PARSER_TYPE(boost::spirit::qi::short_)
74  >,
75 
76  boost::mpl::pair<
77  pni::core::int32,
78  PARSER_TYPE(boost::spirit::qi::int_)
79  >,
80 
81  boost::mpl::pair<
82  pni::core::int64,
83  PARSER_TYPE(boost::spirit::long_)
84  >,
85 
86  boost::mpl::pair<
87  core::float32,
88  PARSER_TYPE(boost::spirit::float_)
89  >,
90 
91  boost::mpl::pair<
92  pni::core::float64,
93  PARSER_TYPE(boost::spirit::double_)
94  >,
95 
96  boost::mpl::pair<
97  pni::core::float128,
98  PARSER_TYPE(boost::spirit::long_double)
99  >,
100 
101  boost::mpl::pair<
102  pni::core::bool_t,
103  PARSER_TYPE(boost::spirit::bool_)
104  >,
105 
106  boost::mpl::pair<
107  bool,
108  PARSER_TYPE(boost::spirit::bool_)
109  >
111 
112 //end of namespace
113 }
114 }
#define PARSER_TYPE(p)
Definition: spirit_rules.hpp:35
Definition: cbf_reader.hpp:41
boost::mpl::map< boost::mpl::pair< pni::core::uint8, boost::spirit::qi::uint_parser< pni::core::uint8, 10, 1, 4 > >, boost::mpl::pair< pni::core::uint16, >, boost::mpl::pair< pni::core::uint32, >, boost::mpl::pair< pni::core::uint64, >, boost::mpl::pair< pni::core::int8, boost::spirit::qi::uint_parser< pni::core::int8, 10, 1, 4 > >, boost::mpl::pair< pni::core::int16, >, boost::mpl::pair< pni::core::int32, >, boost::mpl::pair< pni::core::int64, >, boost::mpl::pair< core::float32, >, boost::mpl::pair< pni::core::float64, >, boost::mpl::pair< pni::core::float128, >, boost::mpl::pair< pni::core::bool_t, >, boost::mpl::pair< bool, > > spirit_rules
spirit rule map
Definition: spirit_rules.hpp:110