Newer
Older
#ifndef LIB4NEURO_EXPRTKWRAPPERSERIALIZATION_H
#define LIB4NEURO_EXPRTKWRAPPERSERIALIZATION_H
Martin Beseda
committed
#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;
Martin Beseda
committed
/**
* Class implementing the private properties
* of ExprtkWrapper class.
*/
Martin Beseda
committed
public:
/**
* Struct used to access private properties from
* the serialization function
*/
struct access;
/**
*
*/
Martin Beseda
committed
/**
*
*/
Martin Beseda
committed
/**
*
*/
Martin Beseda
committed
/**
* 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) {
Martin Beseda
committed
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);
Martin Beseda
committed
}
} // namespace serialization
} // namespace boost
#endif //LIB4NEURO_EXPRTKWRAPPERSERIALIZATION_H