1 #ifndef STLPLUS_PERSISTENT_INTERFACE
2 #define STLPLUS_PERSISTENT_INTERFACE
3 ////////////////////////////////////////////////////////////////////////////////
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
10 // Persistence for pointers to polymorphic classes using the interface approach.
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.
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
22 // Objects are always dumped/restored as pointers to the superclass T.
24 // Multiple pointers to the same object are handled in the same way as for
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.
32 ////////////////////////////////////////////////////////////////////////////////
33 #include "persistence_fixes.hpp"
34 #include "persistent_contexts.hpp"
35 #include "persistent.hpp"
37 ////////////////////////////////////////////////////////////////////////////////
43 void dump_interface(dump_context
&, const T
* const data
)
44 throw(persistent_dump_failed
);
47 void restore_interface(restore_context
&, T
*& data
)
48 throw(persistent_restore_failed
);
50 } // end namespace stlplus
52 ////////////////////////////////////////////////////////////////////////////////
53 #include "persistent_interface.tpp"