]> Dogcows Code - chaz/yoink/blob - src/stlplus/persistence/persistent_pointer.hpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / persistence / persistent_pointer.hpp
1 #ifndef STLPLUS_PERSISTENT_POINTER
2 #define STLPLUS_PERSISTENT_POINTER
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 persistent objects
11
12 // Warning! The pointer must be a dynamically-allocated type, since the
13 // implementation uses new/delete
14
15 // Multiple pointers to the same object *will* be restored as multiple pointers
16 // to the same object. The object is dumped only the first time it is
17 // encountered along with a "magic key". Subsequent pointers to the same object
18 // cause only the magic key to be dumped. On restore, the object is only
19 // restored once and the magic keys are matched up so that the other pointers
20 // now point to the restored object.
21
22 // Supports null pointers too! If the data field to restore is null and the
23 // file format non-null, allocates a new T(). If the data field is non-null and
24 // the file format is null, deletes it and sets it null
25
26 ////////////////////////////////////////////////////////////////////////////////
27 #include "persistence_fixes.hpp"
28 #include "persistent_contexts.hpp"
29
30 ////////////////////////////////////////////////////////////////////////////////
31
32 namespace stlplus
33 {
34
35 template<typename T, typename D>
36 void dump_pointer(dump_context&, const T* const data, D dump_fn)
37 throw(persistent_dump_failed);
38
39 template<typename T, typename R>
40 void restore_pointer(restore_context&, T*& data, R restore_fn)
41 throw(persistent_restore_failed);
42
43 } // end namespace stlplus
44
45 ////////////////////////////////////////////////////////////////////////////////
46 #include "persistent_pointer.tpp"
47 #endif
This page took 0.031468 seconds and 4 git commands to generate.