From a757b19f51ac7aa120e6829b573187b1ff36301a Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 30 Oct 2009 18:06:37 -0400 Subject: Added serialization methods for most type This allows journal_t objects to be completed serialized to disk and deserialized. --- src/op.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/op.h') diff --git a/src/op.h b/src/op.h index 7690d6bc..8d474b80 100644 --- a/src/op.h +++ b/src/op.h @@ -290,6 +290,33 @@ public: static ptr_op_t wrap_value(const value_t& val); static ptr_op_t wrap_functor(const function_t& fobj); + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template + void serialize(Archive & ar, const unsigned int /* version */) { + ar & refc; + ar & kind; + if (Archive::is_loading::value || ! left_ || left_->kind != FUNCTION) { + ar & left_; + } else { + ptr_op_t temp_op; + ar & temp_op; + } + if (Archive::is_loading::value || kind == VALUE || kind == IDENT || + (kind > UNARY_OPERATORS && + (! has_right() || ! right()->is_function()))) { + ar & data; + } else { + variant temp_data; + ar & temp_data; + } + } +#endif // HAVE_BOOST_SERIALIZATION }; inline expr_t::ptr_op_t -- cgit v1.2.3