Newer
Older
#ifndef LIB4NEURO_EXPRTKWRAPPERSERIALIZATION_H
#define LIB4NEURO_EXPRTKWRAPPERSERIALIZATION_H
Martin Beseda
committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/serialization/export.hpp>
//TODO check different order of headers - possible bug
#include "ExprtkWrapper.h"
#include "exprtk.hpp"
BOOST_CLASS_EXPORT_KEY(ExprtkWrapper);
typedef exprtk::symbol_table<double> symbol_table_t;
typedef exprtk::expression<double> expression_t;
typedef exprtk::parser<double> parser_t;
/**
* Class implementing the private properties
* of ExprtkWrapper class.
*/
class ExprtkWrapper :: ExprtkWrapperImpl {
public:
/**
* Struct used to access private properties from
* the serialization function
*/
struct access;
/**
*
*/
expression_t *expression = nullptr;
/**
*
*/
symbol_table_t *symbol_table = nullptr;
/**
*
*/
parser_t * parser = nullptr;
/**
* variables
*/
double x, y, z, t, f;
/**
* referential expression string
*/
std::string expression_str;
};
struct ExprtkWrapper :: access {
template <class Archive>
static void serialize(Archive &ar, ExprtkWrapper& n, const unsigned int version) {
ar & n.p_impl->expression_str;
ar & n.p_impl->x & n.p_impl->y & n.p_impl->z & n.p_impl->t & n.p_impl->f;
}
};
namespace boost {
namespace serialization {
/**
* Serialization function
* @tparam Archive Boost library template
* @param ar Boost parameter - filled automatically during serialization!
* @param n ExprtkWrapper instance
* @param version Boost parameter - filled automatically during serialization!
*/
template<class Archive>
void serialize(Archive & ar, ExprtkWrapper& n, const unsigned int version)
{
ExprtkWrapper::access::serialize(ar, n, version);
}
} // namespace serialization
} // namespace boost
#endif //LIB4NEURO_EXPRTKWRAPPERSERIALIZATION_H