Ariles
reader.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 namespace ariles2
17 {
18  namespace ns_msgpack
19  {
20  namespace impl
21  {
22  class Reader;
23  }
24 
25 
26  /**
27  * @brief Configuration reader class
28  */
29  class Reader : public serialization::PIMPLVisitor<read::Visitor, impl::Reader>
30  {
31  protected:
32  bool startRoot(const std::string &name);
33  void endRoot(const std::string &name);
34 
35 
36  public:
37  /**
38  * @brief Constructor
39  *
40  * @param[in] file_name
41  */
42  explicit Reader(const std::string &file_name);
43 
44 
45  /**
46  * @brief Constructor
47  *
48  * @param[in] input_stream
49  */
50  explicit Reader(std::istream &input_stream);
51 
52 
53  void startMap(
54  const SizeLimitEnforcementType limit_type = SIZE_LIMIT_NONE,
55  const std::size_t min = 0,
56  const std::size_t max = 0);
57  bool startMapEntry(const std::string &child_name);
58  void endMapEntry();
59 
60 
61  std::size_t startArray();
62  void startArrayElement();
63  void endArrayElement();
64  void endArray();
65 
66 
67 #define ARILES2_BASIC_TYPE(type) void readElement(type &element);
68 
70 
71 #undef ARILES2_BASIC_TYPE
72  };
73  } // namespace ns_msgpack
74 } // namespace ariles2
Configuration reader class.
Definition: reader.h:30
void endMapEntry()
endMapEntry from the current entry to its parent.
Definition: reader.cpp:175
bool startRoot(const std::string &name)
Definition: reader.cpp:214
bool startMapEntry(const std::string &child_name)
startMapEntry to the entry with the given name
Definition: reader.cpp:135
void startMap(const SizeLimitEnforcementType limit_type=SIZE_LIMIT_NONE, const std::size_t min=0, const std::size_t max=0)
Definition: reader.cpp:127
void endRoot(const std::string &name)
Definition: reader.cpp:228
Reader(const std::string &file_name)
Constructor.
Definition: reader.cpp:115
std::size_t startArray()
Definition: reader.cpp:182
#define ARILES2_BASIC_TYPES_LIST
Definition: helpers.h:72
#define CPPUT_MACRO_SUBSTITUTE(macro)
Definition: misc.h:21
Definition: basic.h:17