]> Dogcows Code - chaz/yoink/blob - src/stlplus/persistence/persistent_interface.hpp
archiving support for releases
[chaz/yoink] / src / stlplus / persistence / persistent_interface.hpp
1 #ifndef STLPLUS_PERSISTENT_INTERFACE
2 #define STLPLUS_PERSISTENT_INTERFACE
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 interface approach.
11
12 // This works on a set of classes derived from a common superclass called
13 // persistent which is declared as an interface. Each subclass has a set of
14 // methods that enable clone/dump/restore operations. Each subclass must be
15 // registered with the persistence dump/restore context so that the system
16 // knows how to dump it.
17
18 // This approach is suited to classes that can be modified to add persistence
19 // methods. See persistent_callback for a non-invasive way of handling
20 // polymorphism.
21
22 // Objects are always dumped/restored as pointers to the superclass T.
23
24 // Multiple pointers to the same object are handled in the same way as for
25 // simple pointers
26
27 // Only classes registered with the context can be dumped and restored as
28 // polymorphic types - see dump_context::register_interface and
29 // restore_context::register_interface. Attempting to use any unrecognised class
30 // will throw an exception.
31
32 ////////////////////////////////////////////////////////////////////////////////
33 #include "persistence_fixes.hpp"
34 #include "persistent_contexts.hpp"
35 #include "persistent.hpp"
36
37 ////////////////////////////////////////////////////////////////////////////////
38
39 namespace stlplus
40 {
41
42 template<typename T>
43 void dump_interface(dump_context&, const T* const data)
44 throw(persistent_dump_failed);
45
46 template<typename T>
47 void restore_interface(restore_context&, T*& data)
48 throw(persistent_restore_failed);
49
50 } // end namespace stlplus
51
52 ////////////////////////////////////////////////////////////////////////////////
53 #include "persistent_interface.tpp"
54 #endif
This page took 0.036486 seconds and 4 git commands to generate.