]> Dogcows Code - chaz/yoink/blobdiff - src/stlplus/persistence/persistent_callback.hpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / persistence / persistent_callback.hpp
diff --git a/src/stlplus/persistence/persistent_callback.hpp b/src/stlplus/persistence/persistent_callback.hpp
new file mode 100644 (file)
index 0000000..034f43e
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef STLPLUS_PERSISTENT_CALLBACK\r
+#define STLPLUS_PERSISTENT_CALLBACK\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 polymorphic classes using the callback approach.\r
+\r
+//   This works on a set of classes. Each subclass has a set of callback\r
+//   (non-method) functions that enable create/dump/restore operations. Each\r
+//   subclass must be registered with the persistence dump/restore context so\r
+//   that the system knows how to handle it.\r
+\r
+//   This approach is suited to classes that cannot be modified to add\r
+//   persistence methods. See persistent_interface for a more C++-like way of\r
+//   handling polymorphism.\r
+\r
+//   Objects are always dumped/restored as pointers to the superclass T.\r
+\r
+//   Multiple pointers to the same object are handled in the same way as for\r
+//   simple pointers\r
+\r
+//   Only classes registered with the context can be dumped and restored as\r
+//   polymorphic types - see dump_context::register_callback and\r
+//   restore_context::register_callback. Attempting to use any unrecognised class\r
+//   will throw an exception.\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+#include "persistence_fixes.hpp"\r
+#include "persistent_contexts.hpp"\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+namespace stlplus\r
+{\r
+\r
+  template<typename T>\r
+  void dump_callback(dump_context&, const T* const data)\r
+    throw(persistent_dump_failed);\r
+\r
+  template<typename T>\r
+  void restore_callback(restore_context&, T*& data)\r
+    throw(persistent_restore_failed);\r
+\r
+} // end namespace stlplus\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+#include "persistent_callback.tpp"\r
+#endif\r
This page took 0.023054 seconds and 4 git commands to generate.