summaryrefslogtreecommitdiff
path: root/src/scope.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-30 18:06:37 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-30 18:06:37 -0400
commita757b19f51ac7aa120e6829b573187b1ff36301a (patch)
tree5e6d4ef278f3f9915713f958979a4c35a53378fb /src/scope.h
parent1b8811f997568d8aede86197a36fc65586996494 (diff)
downloadfork-ledger-a757b19f51ac7aa120e6829b573187b1ff36301a.tar.gz
fork-ledger-a757b19f51ac7aa120e6829b573187b1ff36301a.tar.bz2
fork-ledger-a757b19f51ac7aa120e6829b573187b1ff36301a.zip
Added serialization methods for most type
This allows journal_t objects to be completed serialized to disk and deserialized.
Diffstat (limited to 'src/scope.h')
-rw-r--r--src/scope.h66
1 files changed, 64 insertions, 2 deletions
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
};
/**