Ariles
Loading...
Searching...
No Matches
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
32namespace ariles2
33{
34 namespace ns_octave
35 {
36 namespace impl
37 {
38 class Writer;
39 }
40
41
42 /**
43 * @brief Configuration writer class
44 */
45 class Writer : public serialization::PIMPLVisitor<write::Visitor, impl::Writer>
46 {
47 public:
48 explicit Writer(const std::string &file_name);
49 explicit Writer(std::ostream &output_stream);
50
51
52 void flush();
53
54
55 void startMapEntry(const std::string &map_name);
56 void endMapEntry();
57
58
59 bool startIteratedMap(const std::size_t /*num_entries*/, const Parameters &)
60 {
61 return (false);
62 }
63
64
65 void startArray(const std::size_t size, const bool compact = false);
66 void endArrayElement();
67 void endArray();
68
69
70 void startVector(const std::size_t size);
71 void startVectorElement();
72 void endVectorElement();
73 void endVector();
74
75
76 void startMatrix(
77 const bool dynamic,
78 const std::size_t cols,
79 const std::size_t rows,
80 const Parameters &param);
81 void startMatrixRow(const std::size_t /*cols*/, const Parameters & /*param*/);
82 void startMatrixElement();
83 void endMatrixElement();
84 void endMatrixRow(const Parameters & /*param*/);
85 void endMatrix(const bool dynamic, const Parameters & /*param*/);
86
87
88#define ARILES2_BASIC_TYPE(type) void writeElement(const type &element, const Parameters &param);
89
92
93#undef ARILES2_BASIC_TYPE
94 };
95 } // namespace ns_octave
96} // namespace ariles2
97
98
99namespace ariles2
100{
101 /**
102 * @brief Octave visitor.
103 * @ingroup octave
104 */
109} // namespace ariles2
Configuration writer class.
Definition octave.h:46
void startMatrix(const bool dynamic, const std::size_t cols, const std::size_t rows, const Parameters &param)
Definition writer.cpp:186
void startMatrixRow(const std::size_t, const Parameters &)
Definition writer.cpp:196
void flush()
Flush the configuration to the output.
Definition writer.cpp:98
void startArray(const std::size_t size, const bool compact=false)
Definition writer.cpp:135
void startVector(const std::size_t size)
Definition writer.cpp:164
void startMapEntry(const std::string &map_name)
Starts a nested map in the configuration file.
Definition writer.cpp:105
void endMatrixRow(const Parameters &)
Definition writer.cpp:214
bool startIteratedMap(const std::size_t, const Parameters &)
Definition octave.h:59
void endMatrix(const bool dynamic, const Parameters &)
Definition writer.cpp:219
t_Parameters Parameters
Definition common.h:49
#define ARILES2_COMPLEX_NUMBER_TYPES_LIST
Definition helpers.h:68
#define ARILES2_BASIC_TYPES_LIST
Definition helpers.h:72
#define CPPUT_MACRO_SUBSTITUTE(macro)
Definition misc.h:21
Octave visitor.
Definition octave.h:106