#ifndef LIB4NEURO_EXPRTKWRAPPERSERIALIZATION_H #define LIB4NEURO_EXPRTKWRAPPERSERIALIZATION_H #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