Ariles
octave.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4 
5  @copyright 2018-2020 Alexander Sherikov, Licensed under the Apache License, Version 2.0.
6  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
7 
8  @brief
9 */
10 
11 /**
12 @defgroup octave Octave
13 @ingroup config
14 
15 @brief Serialize to Octave/MATLAB script.
16 
17 @note Eigen matrices are written in the 'native' format, so they can be used
18  directly, no reshaping is necessary.
19 
20 @note Matlab might be supported, but has not been tested.
21 */
22 
23 
24 #pragma once
25 
26 #define ARILES2_VISITOR_INCLUDED_octave
27 
30 
31 
32 namespace ariles2
33 {
34  namespace ns_octave
35  {
36  namespace impl
37  {
39  }
40 
41 
42  /**
43  * @brief Configuration writer class
44  */
46  {
47  protected:
48  typedef impl::Writer Impl;
50 
51  protected:
53 
54 
55  public:
56  explicit Writer(const std::string &file_name);
57  explicit Writer(std::ostream &output_stream);
58 
59 
60  void flush();
61 
62 
63  void startMapEntry(const std::string &map_name);
64  void endMapEntry();
65 
66 
67  bool startIteratedMap(const std::size_t /*num_entries*/, const Parameters &)
68  {
69  return (false);
70  }
71 
72 
73  void startArray(const std::size_t size, const bool compact = false);
74  void endArrayElement();
75  void endArray();
76 
77 
78  void startVector(const std::size_t size);
79  void startVectorElement();
80  void endVectorElement();
81  void endVector();
82 
83 
84  void startMatrix(
85  const bool dynamic,
86  const std::size_t cols,
87  const std::size_t rows,
88  const Parameters &param);
89  void startMatrixRow(const std::size_t /*cols*/, const Parameters & /*param*/);
90  void startMatrixElement();
91  void endMatrixElement();
92  void endMatrixRow(const Parameters & /*param*/);
93  void endMatrix(const bool dynamic, const Parameters & /*param*/);
94 
95 
96 #define ARILES2_BASIC_TYPE(type) void writeElement(const type &element, const Parameters &param);
97 
100 
101 #undef ARILES2_BASIC_TYPE
102  };
103  } // namespace ns_octave
104 } // namespace ariles2
105 
106 
107 namespace ariles2
108 {
109  /**
110  * @brief Octave visitor.
111  * @ingroup octave
112  */
114  {
116  };
117 } // namespace ariles2
ariles2
Definition: basic.h:16
ariles2::write::Visitor
Definition: write.h:367
ARILES2_BASIC_TYPES_LIST
#define ARILES2_BASIC_TYPES_LIST
Definition: helpers.h:131
ariles2::octave::Writer
ariles2::cfgwrite::Visitor< ns_octave::Writer > Writer
Definition: octave.h:115
ariles2::ns_octave::ARILES2_MACRO_SUBSTITUTE
ARILES2_MACRO_SUBSTITUTE(ARILES2_BASIC_NUMERIC_TYPES_LIST) void Writer
Definition: writer.cpp:255
ARILES2_COMPLEX_NUMBER_TYPES_LIST
#define ARILES2_COMPLEX_NUMBER_TYPES_LIST
Definition: helpers.h:127
ariles2::ns_octave::Writer::Impl
impl::Writer Impl
Definition: octave.h:48
ariles2::ns_octave::Writer::ImplPtr
ARILES2_SHARED_PTR< impl::Writer > ImplPtr
Definition: octave.h:49
helpers.h
ariles2::ns_octave::Writer::impl_
ImplPtr impl_
Definition: octave.h:52
ARILES2_VISIBILITY_ATTRIBUTE
#define ARILES2_VISIBILITY_ATTRIBUTE
Definition: helpers.h:138
ariles2::ns_octave::impl::Writer
Definition: writer.cpp:34
ariles2::octave
Octave visitor.
Definition: octave.h:113
ariles2::ns_octave::impl::Writer
class ARILES2_VISIBILITY_ATTRIBUTE Writer
Definition: octave.h:38
ARILES2_SHARED_PTR< impl::Writer >
ariles2::cfgwrite::Visitor
Definition: config.h:181
ariles2::ns_octave::Writer
Configuration writer class.
Definition: octave.h:45
config.h
ariles2::ns_octave::Writer::startIteratedMap
bool startIteratedMap(const std::size_t, const Parameters &)
Definition: octave.h:67