williamr@2
|
1 |
#ifndef BOOST_ARCHIVE_BASIC_OARCHIVE_HPP
|
williamr@2
|
2 |
#define BOOST_ARCHIVE_BASIC_OARCHIVE_HPP
|
williamr@2
|
3 |
|
williamr@2
|
4 |
// MS compatible compilers support #pragma once
|
williamr@2
|
5 |
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
williamr@2
|
6 |
# pragma once
|
williamr@2
|
7 |
#endif
|
williamr@2
|
8 |
|
williamr@2
|
9 |
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
williamr@2
|
10 |
// basic_oarchive.hpp:
|
williamr@2
|
11 |
|
williamr@2
|
12 |
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
williamr@2
|
13 |
// Use, modification and distribution is subject to the Boost Software
|
williamr@2
|
14 |
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
williamr@2
|
15 |
// http://www.boost.org/LICENSE_1_0.txt)
|
williamr@2
|
16 |
|
williamr@2
|
17 |
// See http://www.boost.org for updates, documentation, and revision history.
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <boost/config.hpp>
|
williamr@2
|
20 |
#include <boost/detail/workaround.hpp>
|
williamr@2
|
21 |
|
williamr@2
|
22 |
// can't use this - much as I'd like to as borland doesn't support it
|
williamr@2
|
23 |
// #include <boost/scoped_ptr.hpp>
|
williamr@2
|
24 |
|
williamr@2
|
25 |
#include <boost/archive/basic_archive.hpp>
|
williamr@2
|
26 |
#include <boost/serialization/tracking_enum.hpp>
|
williamr@2
|
27 |
|
williamr@2
|
28 |
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
williamr@2
|
29 |
|
williamr@2
|
30 |
namespace boost {
|
williamr@2
|
31 |
template<class T>
|
williamr@2
|
32 |
class shared_ptr;
|
williamr@2
|
33 |
|
williamr@2
|
34 |
namespace serialization {
|
williamr@2
|
35 |
class extended_type_info;
|
williamr@2
|
36 |
} // namespace serialization
|
williamr@2
|
37 |
|
williamr@2
|
38 |
namespace archive {
|
williamr@2
|
39 |
namespace detail {
|
williamr@2
|
40 |
|
williamr@2
|
41 |
class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive_impl;
|
williamr@2
|
42 |
class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer;
|
williamr@2
|
43 |
class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer;
|
williamr@2
|
44 |
//////////////////////////////////////////////////////////////////////
|
williamr@2
|
45 |
// class basic_oarchive - write serialized objects to an output stream
|
williamr@2
|
46 |
class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive
|
williamr@2
|
47 |
{
|
williamr@2
|
48 |
friend class basic_oarchive_impl;
|
williamr@2
|
49 |
// hide implementation of this class to minimize header conclusion
|
williamr@2
|
50 |
// in client code. note: borland can't use scoped_ptr
|
williamr@2
|
51 |
//boost::scoped_ptr<basic_oarchive_impl> pimpl;
|
williamr@2
|
52 |
basic_oarchive_impl * pimpl;
|
williamr@2
|
53 |
|
williamr@2
|
54 |
// overload these to bracket object attributes. Used to implement
|
williamr@2
|
55 |
// xml archives
|
williamr@2
|
56 |
virtual void vsave(const version_type t) = 0;
|
williamr@2
|
57 |
virtual void vsave(const object_id_type t) = 0;
|
williamr@2
|
58 |
virtual void vsave(const object_reference_type t) = 0;
|
williamr@2
|
59 |
virtual void vsave(const class_id_type t) = 0;
|
williamr@2
|
60 |
virtual void vsave(const class_id_optional_type t) = 0;
|
williamr@2
|
61 |
virtual void vsave(const class_id_reference_type t) = 0;
|
williamr@2
|
62 |
virtual void vsave(const class_name_type & t) = 0;
|
williamr@2
|
63 |
virtual void vsave(const tracking_type t) = 0;
|
williamr@2
|
64 |
protected:
|
williamr@2
|
65 |
basic_oarchive(unsigned int flags);
|
williamr@2
|
66 |
// account for bogus gcc warning
|
williamr@2
|
67 |
#if defined(__GNUC__)
|
williamr@2
|
68 |
virtual
|
williamr@2
|
69 |
#endif
|
williamr@2
|
70 |
~basic_oarchive();
|
williamr@2
|
71 |
public:
|
williamr@2
|
72 |
// note: NOT part of the public interface
|
williamr@2
|
73 |
void register_basic_serializer(const basic_oserializer & bos);
|
williamr@2
|
74 |
void
|
williamr@2
|
75 |
lookup_basic_helper(
|
williamr@2
|
76 |
const boost::serialization::extended_type_info * const eti,
|
williamr@2
|
77 |
shared_ptr<void> & sph
|
williamr@2
|
78 |
);
|
williamr@2
|
79 |
void
|
williamr@2
|
80 |
insert_basic_helper(
|
williamr@2
|
81 |
const boost::serialization::extended_type_info * const eti,
|
williamr@2
|
82 |
shared_ptr<void> & sph
|
williamr@2
|
83 |
);
|
williamr@2
|
84 |
void save_object(
|
williamr@2
|
85 |
const void *x,
|
williamr@2
|
86 |
const basic_oserializer & bos
|
williamr@2
|
87 |
);
|
williamr@2
|
88 |
void save_pointer(
|
williamr@2
|
89 |
const void * t,
|
williamr@2
|
90 |
const basic_pointer_oserializer * bpos_ptr
|
williamr@2
|
91 |
);
|
williamr@2
|
92 |
void save_null_pointer(){
|
williamr@2
|
93 |
vsave(NULL_POINTER_TAG);
|
williamr@2
|
94 |
}
|
williamr@2
|
95 |
// real public interface starts here
|
williamr@2
|
96 |
void end_preamble(); // default implementation does nothing
|
williamr@2
|
97 |
unsigned int get_library_version() const;
|
williamr@2
|
98 |
unsigned int get_flags() const;
|
williamr@2
|
99 |
};
|
williamr@2
|
100 |
|
williamr@2
|
101 |
} // namespace detail
|
williamr@2
|
102 |
} // namespace archive
|
williamr@2
|
103 |
} // namespace boost
|
williamr@2
|
104 |
|
williamr@2
|
105 |
// required by smart_cast for compilers not implementing
|
williamr@2
|
106 |
// partial template specialization
|
williamr@2
|
107 |
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
|
williamr@2
|
108 |
boost::archive::detail::basic_oarchive
|
williamr@2
|
109 |
)
|
williamr@2
|
110 |
|
williamr@2
|
111 |
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
williamr@2
|
112 |
|
williamr@2
|
113 |
#endif //BOOST_ARCHIVE_BASIC_OARCHIVE_HPP
|