Ariles
reader_compact.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4 
5  @copyright 2014-2017 INRIA. Licensed under the Apache License, Version 2.0.
6  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
7 
8  @copyright 2017-2018 Alexander Sherikov, Licensed under the Apache License, Version 2.0.
9  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
10 
11  @brief
12 */
13 
14 #pragma once
15 
16 #include <iostream>
17 
18 namespace ariles2
19 {
20  namespace ns_msgpack_compact
21  {
22  namespace impl
23  {
24  class Reader;
25  }
26 
27 
28  /**
29  * @brief Configuration reader class
30  */
31  class Reader : public serialization::PIMPLVisitor<read::Visitor, impl::Reader>
32  {
33  public:
34  /**
35  * @brief Constructor
36  *
37  * @param[in] file_name
38  */
39  explicit Reader(const std::string &file_name);
40 
41 
42  /**
43  * @brief Constructor
44  *
45  * @param[in] input_stream
46  */
47  explicit Reader(std::istream &input_stream);
48 
49 
50  void startMap(
51  const SizeLimitEnforcementType limit_type = SIZE_LIMIT_NONE,
52  const std::size_t min = 0,
53  const std::size_t max = 0);
54  bool startMapEntry(const std::string &);
55  void endMapEntry();
56  void endMap();
57 
58 
59  std::size_t startArray();
60  void startArrayElement();
61  void endArrayElement();
62  void endArray();
63 
64  bool startRoot(const std::vector<std::string> &)
65  {
66  CPPUT_THROW("Subtree reading is impossible with msgpack_compact");
67  return (false);
68  }
69 
70  void endRoot(const std::vector<std::string> &)
71  {
72  CPPUT_THROW("Subtree reading is impossible with msgpack_compact");
73  }
74 
75 #define ARILES2_BASIC_TYPE(type) void readElement(type &element);
76 
78 
79 #undef ARILES2_BASIC_TYPE
80  };
81  } // namespace ns_msgpack_compact
82 } // namespace ariles2
Configuration reader class.
void endMapEntry()
endMapEntry from the current entry to its parent.
void startMap(const SizeLimitEnforcementType limit_type=SIZE_LIMIT_NONE, const std::size_t min=0, const std::size_t max=0)
bool startMapEntry(const std::string &)
startMapEntry to the entry with the given name
Reader(const std::string &file_name)
Constructor.
bool startRoot(const std::vector< std::string > &)
void endRoot(const std::vector< std::string > &)
#define CPPUT_THROW(...)
Definition: exception.h:19
#define ARILES2_BASIC_TYPES_LIST
Definition: helpers.h:72
#define CPPUT_MACRO_SUBSTITUTE(macro)
Definition: misc.h:21
Definition: basic.h:17