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  {
25  }
26 
27 
28  /**
29  * @brief Configuration reader class
30  */
31  class ARILES2_VISIBILITY_ATTRIBUTE 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  ARILES2_THROW("Subtree reading is impossible with msgpack_compact");
67  return (false);
68  }
69 
70  void endRoot(const std::vector<std::string> &)
71  {
72  ARILES2_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
ariles2
Definition: basic.h:16
ariles2::ns_msgpack_compact::impl::Reader
Definition: reader_compact.cpp:36
ARILES2_BASIC_TYPES_LIST
#define ARILES2_BASIC_TYPES_LIST
Definition: helpers.h:131
ariles2::read::Visitor::SizeLimitEnforcementType
SizeLimitEnforcementType
Definition: read.h:47
ariles2::ns_octave::ARILES2_MACRO_SUBSTITUTE
ARILES2_MACRO_SUBSTITUTE(ARILES2_BASIC_NUMERIC_TYPES_LIST) void Writer
Definition: writer.cpp:255
ariles2::serialization::PIMPLVisitor
Definition: serialization.h:121
ARILES2_VISIBILITY_ATTRIBUTE
#define ARILES2_VISIBILITY_ATTRIBUTE
Definition: helpers.h:138
ariles2::ns_msgpack_compact::Reader::startRoot
bool startRoot(const std::vector< std::string > &)
Definition: reader_compact.h:64
ariles2::ns_msgpack_compact::Reader::endRoot
void endRoot(const std::vector< std::string > &)
Definition: reader_compact.h:70
ariles2::ns_msgpack_compact::Reader
Configuration reader class.
Definition: reader_compact.h:31
ariles2::ns_msgpack_compact::impl::Reader
class ARILES2_VISIBILITY_ATTRIBUTE Reader
Definition: reader_compact.h:24