]> Dogcows Code - chaz/yoink/blob - src/stlplus/persistence/persistent_callback.hpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / persistence / persistent_callback.hpp
1 #ifndef STLPLUS_PERSISTENT_CALLBACK
2 #define STLPLUS_PERSISTENT_CALLBACK
3 ////////////////////////////////////////////////////////////////////////////////
4
5 // Author: Andy Rushton
6 // Copyright: (c) Southampton University 1999-2004
7 // (c) Andy Rushton 2004-2009
8 // License: BSD License, see ../docs/license.html
9
10 // Persistence for pointers to polymorphic classes using the callback approach.
11
12 // This works on a set of classes. Each subclass has a set of callback
13 // (non-method) functions that enable create/dump/restore operations. Each
14 // subclass must be registered with the persistence dump/restore context so
15 // that the system knows how to handle it.
16
17 // This approach is suited to classes that cannot be modified to add
18 // persistence methods. See persistent_interface for a more C++-like way of
19 // handling polymorphism.
20
21 // Objects are always dumped/restored as pointers to the superclass T.
22
23 // Multiple pointers to the same object are handled in the same way as for
24 // simple pointers
25
26 // Only classes registered with the context can be dumped and restored as
27 // polymorphic types - see dump_context::register_callback and
28 // restore_context::register_callback. Attempting to use any unrecognised class
29 // will throw an exception.
30
31 ////////////////////////////////////////////////////////////////////////////////
32
33 #include "persistence_fixes.hpp"
34 #include "persistent_contexts.hpp"
35
36 ////////////////////////////////////////////////////////////////////////////////
37
38 namespace stlplus
39 {
40
41 template<typename T>
42 void dump_callback(dump_context&, const T* const data)
43 throw(persistent_dump_failed);
44
45 template<typename T>
46 void restore_callback(restore_context&, T*& data)
47 throw(persistent_restore_failed);
48
49 } // end namespace stlplus
50
51 ////////////////////////////////////////////////////////////////////////////////
52 #include "persistent_callback.tpp"
53 #endif
This page took 0.030428 seconds and 4 git commands to generate.