]> Dogcows Code - chaz/yoink/blobdiff - src/stlplus/persistence/persistent_pointer.hpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / persistence / persistent_pointer.hpp
diff --git a/src/stlplus/persistence/persistent_pointer.hpp b/src/stlplus/persistence/persistent_pointer.hpp
new file mode 100644 (file)
index 0000000..02d0951
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef STLPLUS_PERSISTENT_POINTER\r
+#define STLPLUS_PERSISTENT_POINTER\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+//   Author:    Andy Rushton\r
+//   Copyright: (c) Southampton University 1999-2004\r
+//              (c) Andy Rushton           2004-2009\r
+//   License:   BSD License, see ../docs/license.html\r
+\r
+//   Persistence for pointers to persistent objects\r
+\r
+//   Warning! The pointer must be a dynamically-allocated type, since the\r
+//   implementation uses new/delete\r
+\r
+//   Multiple pointers to the same object *will* be restored as multiple pointers\r
+//   to the same object. The object is dumped only the first time it is\r
+//   encountered along with a "magic key". Subsequent pointers to the same object\r
+//   cause only the magic key to be dumped. On restore, the object is only\r
+//   restored once and the magic keys are matched up so that the other pointers\r
+//   now point to the restored object.\r
+\r
+//   Supports null pointers too! If the data field to restore is null and the\r
+//   file format non-null, allocates a new T(). If the data field is non-null and\r
+//   the file format is null, deletes it and sets it null\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+#include "persistence_fixes.hpp"\r
+#include "persistent_contexts.hpp"\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+namespace stlplus\r
+{\r
+\r
+  template<typename T, typename D>\r
+  void dump_pointer(dump_context&, const T* const data, D dump_fn)\r
+    throw(persistent_dump_failed);\r
+\r
+  template<typename T, typename R>\r
+  void restore_pointer(restore_context&, T*& data, R restore_fn)\r
+    throw(persistent_restore_failed);\r
+\r
+} // end namespace stlplus\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+#include "persistent_pointer.tpp"\r
+#endif\r
This page took 0.021409 seconds and 4 git commands to generate.