]> Dogcows Code - chaz/yoink/blobdiff - src/stlplus/persistence/persistent_interface.hpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / persistence / persistent_interface.hpp
diff --git a/src/stlplus/persistence/persistent_interface.hpp b/src/stlplus/persistence/persistent_interface.hpp
new file mode 100644 (file)
index 0000000..366954c
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef STLPLUS_PERSISTENT_INTERFACE\r
+#define STLPLUS_PERSISTENT_INTERFACE\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 interface approach.\r
+\r
+//   This works on a set of classes derived from a common superclass called\r
+//   persistent which is declared as an interface. Each subclass has a set of\r
+//   methods that enable clone/dump/restore operations. Each subclass must be\r
+//   registered with the persistence dump/restore context so that the system\r
+//   knows how to dump it.\r
+\r
+//   This approach is suited to classes that can be modified to add persistence\r
+//   methods. See persistent_callback for a non-invasive way of handling\r
+//   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_interface and\r
+//   restore_context::register_interface. Attempting to use any unrecognised class\r
+//   will throw an exception.\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+#include "persistence_fixes.hpp"\r
+#include "persistent_contexts.hpp"\r
+#include "persistent.hpp"\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+namespace stlplus\r
+{\r
+\r
+  template<typename T>\r
+  void dump_interface(dump_context&, const T* const data)\r
+    throw(persistent_dump_failed);\r
+\r
+  template<typename T>\r
+  void restore_interface(restore_context&, T*& data)\r
+    throw(persistent_restore_failed);\r
+\r
+} // end namespace stlplus\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+#include "persistent_interface.tpp"\r
+#endif\r
This page took 0.023369 seconds and 4 git commands to generate.