]> Dogcows Code - chaz/yoink/blobdiff - src/stlplus/persistence/persistent_shortcuts.hpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / persistence / persistent_shortcuts.hpp
diff --git a/src/stlplus/persistence/persistent_shortcuts.hpp b/src/stlplus/persistence/persistent_shortcuts.hpp
new file mode 100644 (file)
index 0000000..beb54d0
--- /dev/null
@@ -0,0 +1,70 @@
+#ifndef STLPLUS_PERSISTENT_SHORTCUTS\r
+#define STLPLUS_PERSISTENT_SHORTCUTS\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
+//   Short-cut functions for dumping and restoring to common targets. These do\r
+//   the whole dump operation in a single function call.\r
+\r
+//   They take as their second template argument a dump or restore functor which\r
+//   is then called to perform the dump/restore operation.\r
+\r
+//   They use an installer callback function to install any polymorphic type\r
+//   handlers required prior to performing the dump/restore. If there are no\r
+//   polymorphic types used in the data structure, then the callback can be set\r
+//   to null (i.e. 0).\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+#include "persistence_fixes.hpp"\r
+#include "persistent_contexts.hpp"\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+namespace stlplus\r
+{\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+  // arbitrary IOStream device\r
+  // must be in binary mode\r
+\r
+  template<typename T, class D>\r
+  void dump_to_device(const T& source, std::ostream& result, D dump_fn, dump_context::installer installer)\r
+    throw(persistent_dump_failed);\r
+\r
+  template<typename T, class R>\r
+  void restore_from_device(std::istream& source, T& result, R restore_fn, restore_context::installer installer)\r
+    throw(persistent_restore_failed);\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+  // string IO device\r
+\r
+  template<typename T, class D>\r
+  void dump_to_string(const T& source, std::string& result, D dump_fn, dump_context::installer installer)\r
+    throw(persistent_dump_failed);\r
+\r
+  template<typename T, class R>\r
+  void restore_from_string(const std::string& source, T& result, R restore_fn, restore_context::installer installer)\r
+    throw(persistent_restore_failed);\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+  // file IO device\r
+\r
+  template<typename T, class D>\r
+  void dump_to_file(const T& source, const std::string& filename, D dump_fn, dump_context::installer installer)\r
+    throw(persistent_dump_failed);\r
+\r
+  template<typename T, class R>\r
+  void restore_from_file(const std::string& filename, T& result, R restore_fn, restore_context::installer installer)\r
+    throw(persistent_restore_failed);\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+\r
+} // end namespace stlplus\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+#include "persistent_shortcuts.tpp"\r
+#endif\r
This page took 0.02479 seconds and 4 git commands to generate.