diff options
-rw-r--r-- | src/account.h | 20 | ||||
-rw-r--r-- | src/amount.cc | 73 | ||||
-rw-r--r-- | src/amount.h | 10 | ||||
-rw-r--r-- | src/annotate.h | 46 | ||||
-rw-r--r-- | src/balance.h | 12 | ||||
-rw-r--r-- | src/commodity.h | 83 | ||||
-rw-r--r-- | src/expr.h | 16 | ||||
-rw-r--r-- | src/flags.h | 22 | ||||
-rw-r--r-- | src/item.h | 35 | ||||
-rw-r--r-- | src/journal.h | 16 | ||||
-rw-r--r-- | src/mask.h | 19 | ||||
-rw-r--r-- | src/op.h | 27 | ||||
-rw-r--r-- | src/pool.h | 18 | ||||
-rw-r--r-- | src/post.h | 17 | ||||
-rw-r--r-- | src/predicate.h | 13 | ||||
-rw-r--r-- | src/scope.h | 66 | ||||
-rw-r--r-- | src/session.cc | 20 | ||||
-rw-r--r-- | src/system.hh.in | 74 | ||||
-rw-r--r-- | src/times.h | 32 | ||||
-rw-r--r-- | src/utils.h | 12 | ||||
-rw-r--r-- | src/value.h | 28 | ||||
-rw-r--r-- | src/xact.h | 67 |
22 files changed, 723 insertions, 3 deletions
diff --git a/src/account.h b/src/account.h index 8c276c8a..9dc467bc 100644 --- a/src/account.h +++ b/src/account.h @@ -232,6 +232,26 @@ public: return xdata_ && xdata_->has_flags(flags); } std::size_t children_with_flags(xdata_t::flags_t flags) const; + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<supports_flags<> >(*this); + ar & boost::serialization::base_object<scope_t>(*this); + ar & parent; + ar & name; + ar & note; + ar & depth; + ar & accounts; + ar & posts; + ar & _fullname; + } +#endif // HAVE_BOOST_SERIALIZATION }; std::ostream& operator<<(std::ostream& out, const account_t& account); diff --git a/src/amount.cc b/src/amount.cc index 6cf3a30b..3ac47c59 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -94,6 +94,20 @@ struct amount_t::bigint_t : public supports_flags<> } return true; } + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive& ar, const unsigned int /* version */) + { + ar & boost::serialization::base_object<supports_flags<> >(*this); + ar & val; + ar & prec; + ar & refc; + } +#endif // HAVE_BOOST_SERIALIZATION }; shared_ptr<commodity_pool_t> amount_t::current_pool; @@ -1107,4 +1121,63 @@ bool amount_t::valid() const return true; } +#if defined(HAVE_BOOST_SERIALIZATION) + +template<class Archive> +void amount_t::serialize(Archive& ar, const unsigned int /* version */) +{ + ar & current_pool; + ar & is_initialized; + ar & quantity; + ar & commodity_; +} + +#endif // HAVE_BOOST_SERIALIZATION + } // namespace ledger + +#if defined(HAVE_BOOST_SERIALIZATION) +namespace boost { +namespace serialization { + +template <class Archive> +void serialize(Archive& ar, MP_INT& mpz, const unsigned int /* version */) +{ + ar & mpz._mp_alloc; + ar & mpz._mp_size; + ar & mpz._mp_d; +} + +template <class Archive> +void serialize(Archive& ar, MP_RAT& mpq, const unsigned int /* version */) +{ + ar & mpq._mp_num; + ar & mpq._mp_den; +} + +template <class Archive> +void serialize(Archive& ar, long unsigned int& integer, + const unsigned int /* version */) +{ + ar & make_binary_object(&integer, sizeof(long unsigned int)); +} + +} // namespace serialization +} // namespace boost + +BOOST_CLASS_EXPORT(ledger::annotated_commodity_t) + +template void boost::serialization::serialize(boost::archive::binary_oarchive&, + MP_INT&, const unsigned int); +template void boost::serialization::serialize(boost::archive::binary_iarchive&, + MP_RAT&, const unsigned int); +template void boost::serialization::serialize(boost::archive::binary_iarchive&, + long unsigned int&, + const unsigned int); + +template void ledger::amount_t::serialize(boost::archive::binary_oarchive&, + const unsigned int); +template void ledger::amount_t::serialize(boost::archive::binary_iarchive&, + const unsigned int); + +#endif // HAVE_BOOST_SERIALIZATION diff --git a/src/amount.h b/src/amount.h index b3c632af..f7d6986e 100644 --- a/src/amount.h +++ b/src/amount.h @@ -691,6 +691,16 @@ public: bool valid() const; +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */); +#endif // HAVE_BOOST_SERIALIZATION + /*@}*/ }; diff --git a/src/annotate.h b/src/annotate.h index d98f7ef6..17c8a637 100644 --- a/src/annotate.h +++ b/src/annotate.h @@ -98,6 +98,21 @@ struct annotation_t : public supports_flags<>, assert(*this); return true; } + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<supports_flags<> >(*this); + ar & price; + ar & date; + ar & tag; + } +#endif // HAVE_BOOST_SERIALIZATION }; struct keep_details_t @@ -136,6 +151,21 @@ struct keep_details_t return keep_price || keep_date || keep_tag; } bool keep_any(const commodity_t& comm) const; + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & keep_price; + ar & keep_date; + ar & keep_tag; + ar & only_actuals; + } +#endif // HAVE_BOOST_SERIALIZATION }; inline std::ostream& operator<<(std::ostream& out, @@ -183,6 +213,22 @@ public: virtual commodity_t& strip_annotations(const keep_details_t& what_to_keep); virtual void write_annotations(std::ostream& out) const; + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + explicit annotated_commodity_t() : ptr(NULL) {} + + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<commodity_t>(*this); + ar & ptr; + ar & details; + } +#endif // HAVE_BOOST_SERIALIZATION }; inline annotated_commodity_t& diff --git a/src/balance.h b/src/balance.h index 6a382069..5452510b 100644 --- a/src/balance.h +++ b/src/balance.h @@ -523,6 +523,18 @@ public: } return true; } + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & amounts; + } +#endif // HAVE_BOOST_SERIALIZATION }; inline std::ostream& operator<<(std::ostream& out, const balance_t& bal) { diff --git a/src/commodity.h b/src/commodity.h index 5d73f4e8..d91fce85 100644 --- a/src/commodity.h +++ b/src/commodity.h @@ -62,6 +62,19 @@ struct price_point_t { datetime_t when; amount_t price; + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & when; + ar & price; + } +#endif // HAVE_BOOST_SERIALIZATION }; /** @@ -78,7 +91,7 @@ class commodity_t public: class base_t : public noncopyable, public supports_flags<uint_least16_t> { - base_t(); + base_t() {} public: typedef std::map<const datetime_t, amount_t> history_map; @@ -100,6 +113,18 @@ public: , const int indent = 0 #endif ) const; + +#if defined(HAVE_BOOST_SERIALIZATION) + private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & prices; + } +#endif // HAVE_BOOST_SERIALIZATION }; typedef std::map<commodity_t *, history_t> history_by_commodity_map; @@ -126,6 +151,18 @@ public: optional<history_t&> history(const optional<commodity_t&>& commodity = none); + +#if defined(HAVE_BOOST_SERIALIZATION) + private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & histories; + } +#endif // HAVE_BOOST_SERIALIZATION }; #define COMMODITY_STYLE_DEFAULTS 0x000 @@ -158,6 +195,25 @@ public: ~base_t() { TRACE_DTOR(base_t); } + +#if defined(HAVE_BOOST_SERIALIZATION) + private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<supports_flags<uint_least16_t> >(*this); + ar & symbol; + ar & precision; + ar & name; + ar & note; + ar & varied_history; + ar & smaller; + ar & larger; + } +#endif // HAVE_BOOST_SERIALIZATION }; public: @@ -330,6 +386,31 @@ public: } bool valid() const; + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + supports_flags<uint_least16_t> temp_flags; + +protected: + explicit commodity_t() + : delegates_flags<uint_least16_t>(temp_flags), parent_(NULL), + annotated(false) {} + +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<delegates_flags<uint_least16_t> >(*this); + ar & base; + ar & parent_; + ar & qualified_symbol; + ar & mapping_key_; + ar & annotated; + } +#endif // HAVE_BOOST_SERIALIZATION }; inline std::ostream& operator<<(std::ostream& out, const commodity_t& comm) { @@ -163,6 +163,22 @@ public: void dump(std::ostream& out) const; static value_t eval(const string& _expr, scope_t& scope); + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & ptr; + ar & context; + ar & str; + if (Archive::is_loading::value) + compiled = false; + } +#endif // HAVE_BOOST_SERIALIZATION }; std::ostream& operator<<(std::ostream& out, const expr_t& expr); diff --git a/src/flags.h b/src/flags.h index 21607fc2..33935556 100644 --- a/src/flags.h +++ b/src/flags.h @@ -99,6 +99,17 @@ public: void drop_flags(const flags_t arg) { _flags = static_cast<T>(static_cast<U>(_flags) & static_cast<U>(~arg)); } + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) + { + ar & _flags; + } +#endif // HAVE_BOOST_SERIALIZATION }; /** @@ -201,6 +212,17 @@ public: void drop_flags(const flags_t arg) { _flags.drop_flags(arg); } + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) + { + ar & _flags; + } +#endif // HAVE_BOOST_SERIALIZATION }; #endif // _FLAGS_H @@ -79,6 +79,22 @@ struct position_t } return *this; } + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & pathname; + ar & beg_pos; + ar & beg_line; + ar & end_pos; + ar & end_line; + } +#endif // HAVE_BOOST_SERIALIZATION }; /** @@ -176,6 +192,25 @@ public: virtual expr_t::ptr_op_t lookup(const string& name); bool valid() const; + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<supports_flags<> >(*this); + ar & boost::serialization::base_object<scope_t>(*this); + ar & _state; + ar & _date; + ar & _date_eff; + ar & note; + ar & metadata; + ar & pos; + } +#endif // HAVE_BOOST_SERIALIZATION }; value_t get_comment(item_t& item); diff --git a/src/journal.h b/src/journal.h index 43309590..809da25d 100644 --- a/src/journal.h +++ b/src/journal.h @@ -110,6 +110,22 @@ public: bool strict = false); bool valid() const; + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & master; + ar & basket; + ar & xacts; + ar & auto_xacts; + ar & period_xacts; + } +#endif // HAVE_BOOST_SERIALIZATION }; } // namespace ledger @@ -94,6 +94,25 @@ public: } return true; } + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + string temp; + if (Archive::is_loading::value) { + ar & temp; + *this = temp; + } else { + temp = expr.str(); + ar & temp; + } + } +#endif // HAVE_BOOST_SERIALIZATION }; inline std::ostream& operator<<(std::ostream& out, const mask_t& mask) { @@ -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<class Archive> + 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<ptr_op_t, value_t, string, function_t> temp_data; + ar & temp_data; + } + } +#endif // HAVE_BOOST_SERIALIZATION }; inline expr_t::ptr_op_t @@ -134,6 +134,24 @@ public: parse_price_expression(const std::string& str, const bool add_prices = true, const optional<datetime_t>& moment = none); + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & commodities; + ar & null_commodity; + ar & default_commodity; + ar & keep_base; + ar & price_db; + ar & quote_leeway; + ar & get_quotes; + } +#endif // HAVE_BOOST_SERIALIZATION }; } // namespace ledger @@ -205,6 +205,23 @@ public: } friend class xact_t; + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<item_t>(*this); + ar & xact; + ar & account; + ar & amount; + ar & cost; + ar & assigned_amount; + } +#endif // HAVE_BOOST_SERIALIZATION }; } // namespace ledger diff --git a/src/predicate.h b/src/predicate.h index 555fac05..5e900234 100644 --- a/src/predicate.h +++ b/src/predicate.h @@ -94,6 +94,19 @@ public: throw; } } + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & predicate; + ar & what_to_keep; + } +#endif // HAVE_BOOST_SERIALIZATION }; class query_lexer_t diff --git a/src/scope.h b/src/scope.h index 2539074e..fc330ba0 100644 --- a/src/scope.h +++ b/src/scope.h @@ -67,6 +67,16 @@ public: virtual void define(const string&, expr_t::ptr_op_t) {} virtual expr_t::ptr_op_t lookup(const string& name) = 0; + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive &, const unsigned int /* version */) {} +#endif // HAVE_BOOST_SERIALIZATION }; /** @@ -100,6 +110,19 @@ public: return parent->lookup(name); return NULL; } + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<scope_t>(*this); + ar & parent; + } +#endif // HAVE_BOOST_SERIALIZATION }; /** @@ -127,6 +150,19 @@ public: virtual void define(const string& name, expr_t::ptr_op_t def); virtual expr_t::ptr_op_t lookup(const string& name); + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<child_scope_t>(*this); + ar & symbols; + } +#endif // HAVE_BOOST_SERIALIZATION }; /** @@ -138,8 +174,6 @@ class call_scope_t : public child_scope_t { value_t args; - call_scope_t(); - public: explicit call_scope_t(scope_t& _parent) : child_scope_t(_parent) { TRACE_CTOR(call_scope_t, "scope_t&"); @@ -182,6 +216,21 @@ public: bool empty() const { return args.size() == 0; } + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + explicit call_scope_t() {} + + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<child_scope_t>(*this); + ar & args; + } +#endif // HAVE_BOOST_SERIALIZATION }; /** @@ -215,6 +264,19 @@ public: return def; return child_scope_t::lookup(name); } + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<child_scope_t>(*this); + ar & grandchild; + } +#endif // HAVE_BOOST_SERIALIZATION }; /** diff --git a/src/session.cc b/src/session.cc index ea9ae180..5caf7a61 100644 --- a/src/session.cc +++ b/src/session.cc @@ -40,6 +40,26 @@ #include "iterators.h" #include "filters.h" +#if defined(HAVE_BOOST_SERIALIZATION) +//BOOST_IS_ABSTRACT(ledger::scope_t) +BOOST_CLASS_EXPORT(ledger::scope_t) +BOOST_CLASS_EXPORT(ledger::child_scope_t) +BOOST_CLASS_EXPORT(ledger::symbol_scope_t) +BOOST_CLASS_EXPORT(ledger::call_scope_t) +BOOST_CLASS_EXPORT(ledger::account_t) +BOOST_CLASS_EXPORT(ledger::item_t) +BOOST_CLASS_EXPORT(ledger::post_t) +BOOST_CLASS_EXPORT(ledger::xact_base_t) +BOOST_CLASS_EXPORT(ledger::xact_t) +BOOST_CLASS_EXPORT(ledger::auto_xact_t) +BOOST_CLASS_EXPORT(ledger::period_xact_t) + +template void ledger::journal_t::serialize(boost::archive::binary_oarchive&, + const unsigned int); +template void ledger::journal_t::serialize(boost::archive::binary_iarchive&, + const unsigned int); +#endif // HAVE_BOOST_SERIALIZATION + namespace ledger { void set_session_context(session_t * session) diff --git a/src/system.hh.in b/src/system.hh.in index 56cb491b..8495600e 100644 --- a/src/system.hh.in +++ b/src/system.hh.in @@ -167,6 +167,80 @@ typedef std::ostream::pos_type ostream_pos_type; #include <boost/variant.hpp> #include <boost/version.hpp> +#if defined(HAVE_BOOST_SERIALIZATION) + +#include <boost/archive/binary_iarchive.hpp> +#include <boost/archive/binary_oarchive.hpp> + +#include <boost/serialization/base_object.hpp> +#include <boost/serialization/binary_object.hpp> +#include <boost/serialization/optional.hpp> +#include <boost/serialization/shared_ptr.hpp> +#include <boost/serialization/variant.hpp> +#include <boost/serialization/utility.hpp> +#include <boost/serialization/export.hpp> +#include <boost/serialization/level.hpp> +#include <boost/serialization/string.hpp> +#include <boost/serialization/vector.hpp> +#include <boost/serialization/deque.hpp> +#include <boost/serialization/list.hpp> +#include <boost/serialization/map.hpp> + +#include <boost/date_time/posix_time/time_serialize.hpp> +#include <boost/date_time/gregorian/greg_serialize.hpp> + +BOOST_CLASS_IMPLEMENTATION(boost::filesystem::path, boost::serialization::primitive_type) +#ifndef BOOST_NO_STD_WSTRING +BOOST_CLASS_IMPLEMENTATION(boost::filesystem::wpath, boost::serialization::primitive_type) +#endif + +namespace boost { +namespace serialization { + +template <class Archive, class String, class Traits> +void serialize(Archive& ar, boost::filesystem::basic_path<String, Traits>& p, + const unsigned int) +{ + String s; + if (Archive::is_saving::value) + s = p.string(); + + ar & s; + + if (Archive::is_loading::value) + p = s; +} + +template <class Archive, class T> +void serialize(Archive& ar, boost::intrusive_ptr<T>& ptr, const unsigned int) +{ + if (Archive::is_saving::value) { + T * p = ptr.get(); + ar & p; + } + else if (Archive::is_loading::value) { + T * p; + ar & p; + ptr.reset(p); + } +} + +template <class Archive, class T> +void serialize(Archive&, boost::function<T>&, const unsigned int) +{ +} + +template <class Archive> +void serialize(Archive& ar, istream_pos_type& pos, const unsigned int) +{ + ar & make_binary_object(&pos, sizeof(istream_pos_type)); +} + +} // namespace serialization +} // namespace boost + +#endif // HAVE_BOOST_SERIALIZATION + #if defined(HAVE_BOOST_PYTHON) #include <boost/python.hpp> diff --git a/src/times.h b/src/times.h index f9f9040a..db83d175 100644 --- a/src/times.h +++ b/src/times.h @@ -170,6 +170,19 @@ public: assert(0); return date_t(); } } + +#if defined(HAVE_BOOST_SERIALIZATION) + private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & quantum; + ar & length; + } +#endif // HAVE_BOOST_SERIALIZATION }; static date_t add_duration(const date_t& date, @@ -244,6 +257,25 @@ public: } date_interval_t& operator++(); + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & start; + ar & aligned; + ar & skip_duration; + ar & factor; + ar & next; + ar & duration; + ar & end_of_duration; + ar & end; + } +#endif // HAVE_BOOST_SERIALIZATION }; void times_initialize(); diff --git a/src/utils.h b/src/utils.h index e3ae5dda..c662acbe 100644 --- a/src/utils.h +++ b/src/utils.h @@ -178,6 +178,18 @@ public: string(const char * str, size_type x); string(const char * str, size_type x, size_type y); ~string() throw(); + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<std::string>(*this); + } +#endif // HAVE_BOOST_SERIALIZATION }; inline string operator+(const string& __lhs, const string& __rhs) diff --git a/src/value.h b/src/value.h index 1670be1b..3c5ce286 100644 --- a/src/value.h +++ b/src/value.h @@ -227,6 +227,20 @@ private: data = false; type = VOID; } + +#if defined(HAVE_BOOST_SERIALIZATION) + private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & data; + ar & type; + ar & refc; + } +#endif // HAVE_BOOST_SERIALIZATION }; /** @@ -896,6 +910,20 @@ public: * Debugging methods. */ bool valid() const; + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & true_value; + ar & false_value; + ar & storage; + } +#endif // HAVE_BOOST_SERIALIZATION }; #define NULL_VALUE (value_t()) @@ -80,6 +80,20 @@ public: virtual bool finalize(); virtual bool valid() const = 0; + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<item_t>(*this); + ar & journal; + ar & posts; + } +#endif // HAVE_BOOST_SERIALIZATION }; /** @@ -111,6 +125,20 @@ public: virtual expr_t::ptr_op_t lookup(const string& name); virtual bool valid() const; + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<xact_base_t>(*this); + ar & code; + ar & payee; + } +#endif // HAVE_BOOST_SERIALIZATION }; /** @@ -154,6 +182,19 @@ public: virtual bool valid() const { return true; } + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<xact_base_t>(*this); + ar & predicate; + } +#endif // HAVE_BOOST_SERIALIZATION }; /** @@ -180,6 +221,18 @@ struct auto_xact_finalizer_t : public xact_finalizer_t } virtual bool operator()(xact_t& xact, bool post); + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & journal; + } +#endif // HAVE_BOOST_SERIALIZATION }; /** @@ -218,6 +271,20 @@ class period_xact_t : public xact_base_t #endif return true; } + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<xact_base_t>(*this); + ar & period; + ar & period_string; + } +#endif // HAVE_BOOST_SERIALIZATION }; /** |