Ariles
Loading...
Searching...
No Matches
extra_visitors
python
ariles2
visitors
python.h
Go to the documentation of this file.
1
/**
2
@file
3
@author Alexander Sherikov
4
5
@copyright 2017-2026 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 python Python
13
@ingroup config
14
15
@brief Python serialization.
16
17
@brief Outputs a Python script that defines variables containing data exported by ariles.
18
Script includes all necessary imports and is intended to be loaded in other python scripts
19
or interactive sessions using `exec(open("output_script.py").read())`. Ariles class exported
20
using 'python' visitor is a single python map similar to this:
21
`root_element={'vector': [1, 2, 3], 'vector_of_maps': [{'a': 'a'}], 'scalar': 2}`,
22
i.e.: ariles maps correspond to python dictionaries, arrays to python arrays, matrices and
23
vectors should be represented using numpy types.
24
25
@note This visitor only supports writing (serialization) as reading Python files properly
26
requires a full Python parser which is beyond the scope of this library.
27
*/
28
29
30
#pragma once
31
32
#define ARILES2_VISITOR_INCLUDED_python
33
34
#include <
ariles2/internal/helpers.h
>
35
#include <
ariles2/visitors/config.h
>
36
37
38
#include "
./python/writer.h
"
39
40
41
namespace
ariles2
42
{
43
/**
44
* @brief Python visitor.
45
* @ingroup python
46
*/
47
struct
python
48
{
49
using
WriterBase
=
ns_python::Writer
;
50
51
using
Writer
=
ariles2::cfgwrite::Visitor<ns_python::Writer>
;
52
53
// Python visitor is write-only; reading Python files requires a full Python parser
54
// The Reader type is defined but not implemented for interface compatibility
55
};
56
}
// namespace ariles2
ariles2::cfgwrite::Visitor
Definition
config.h:61
ariles2::ns_python::Writer
Configuration writer class.
Definition
writer.h:27
config.h
helpers.h
ariles2
Definition
basic.h:17
writer.h
ariles2::python
Python visitor.
Definition
python.h:48
Generated by
1.9.8