X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fstlplus%2Fpersistence%2Fpersistent_xref.hpp;fp=src%2Fstlplus%2Fpersistence%2Fpersistent_xref.hpp;h=c41e28d732d3ae67debda7648f7a9e53d58cdadd;hb=6b0a0d0efafe34d48ab344fca3b479553bd4e62c;hp=0000000000000000000000000000000000000000;hpb=85783316365181491a3e3c0c63659972477cebba;p=chaz%2Fyoink diff --git a/src/stlplus/persistence/persistent_xref.hpp b/src/stlplus/persistence/persistent_xref.hpp new file mode 100644 index 0000000..c41e28d --- /dev/null +++ b/src/stlplus/persistence/persistent_xref.hpp @@ -0,0 +1,48 @@ +#ifndef STLPLUS_PERSISTENT_XREF +#define STLPLUS_PERSISTENT_XREF +//////////////////////////////////////////////////////////////////////////////// + +// Author: Andy Rushton +// Copyright: (c) Southampton University 1999-2004 +// (c) Andy Rushton 2004-2009 +// License: BSD License, see ../docs/license.html + +// Persistence for cross-references to persistent objects + +// A cross-reference is a pointer to an object that has definitely been dumped +// already by one of dump_pointer, dump_interface or dump_callback, i.e. by +// one of the dump routines for pointers to objects. + +// These are typically used in data structures as back-pointers or pointers +// between nodes. + +// For example, you may have a tree with cross links. Dump the tree as the +// primary data structure first, then dump the cross links as cross-references +// afterwards. The whole tree must be dumped before any cross-references to +// ensure that all cross-references are known to the persistence system. + +// These functions will throw an exception if the cross-reference points to +// something not dumped before. + +//////////////////////////////////////////////////////////////////////////////// +#include "persistence_fixes.hpp" +#include "persistent_contexts.hpp" + +//////////////////////////////////////////////////////////////////////////////// + +namespace stlplus +{ + + template + void dump_xref(dump_context&, const T* const data) + throw(persistent_dump_failed); + + template + void restore_xref(restore_context&, T*& data) + throw(persistent_restore_failed); + +} // end namespace stlplus + + //////////////////////////////////////////////////////////////////////////////// +#include "persistent_xref.tpp" +#endif