1 | #ifndef BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_IMPL_HPP
|
---|
2 | #define BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_IMPL_HPP
|
---|
3 |
|
---|
4 | // MS compatible compilers support #pragma once
|
---|
5 | #if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
---|
6 | # pragma once
|
---|
7 | #endif
|
---|
8 |
|
---|
9 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
---|
10 | // polymorphic_iarchive_impl.hpp
|
---|
11 |
|
---|
12 | // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
---|
13 | // Use, modification and distribution is subject to the Boost Software
|
---|
14 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
---|
15 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
16 |
|
---|
17 | // See http://www.boost.org for updates, documentation, and revision history.
|
---|
18 |
|
---|
19 | #include <cstddef>
|
---|
20 | #include <string>
|
---|
21 | #include <ostream>
|
---|
22 | #include <boost/noncopyable.hpp>
|
---|
23 | #include <boost/cstdint.hpp>
|
---|
24 |
|
---|
25 | #include <boost/config.hpp>
|
---|
26 | #if defined(BOOST_NO_STDC_NAMESPACE)
|
---|
27 | namespace std{
|
---|
28 | using ::size_t;
|
---|
29 | } // namespace std
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <boost/archive/polymorphic_iarchive.hpp>
|
---|
33 | #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
---|
34 |
|
---|
35 | namespace boost {
|
---|
36 | template<class T>
|
---|
37 | class shared_ptr;
|
---|
38 | namespace serialization {
|
---|
39 | class extended_type_info;
|
---|
40 | } // namespace serialization
|
---|
41 | namespace archive {
|
---|
42 | namespace detail{
|
---|
43 |
|
---|
44 | class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iserializer;
|
---|
45 | class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer;
|
---|
46 |
|
---|
47 | template<class ArchiveImplementation>
|
---|
48 | class polymorphic_iarchive_impl :
|
---|
49 | public polymorphic_iarchive,
|
---|
50 | // note: gcc dynamic cross cast fails if the the derivation below is
|
---|
51 | // not public. I think this is a mistake.
|
---|
52 | public /*protected*/ ArchiveImplementation,
|
---|
53 | private boost::noncopyable
|
---|
54 | {
|
---|
55 | private:
|
---|
56 | // these are used by the serialization library.
|
---|
57 | virtual void load_object(
|
---|
58 | void *t,
|
---|
59 | const basic_iserializer & bis
|
---|
60 | ){
|
---|
61 | ArchiveImplementation::load_object(t, bis);
|
---|
62 | }
|
---|
63 | virtual const basic_pointer_iserializer * load_pointer(
|
---|
64 | void * & t,
|
---|
65 | const basic_pointer_iserializer * bpis_ptr,
|
---|
66 | const basic_pointer_iserializer * (*finder)(
|
---|
67 | const boost::serialization::extended_type_info & type
|
---|
68 | )
|
---|
69 | ){
|
---|
70 | return ArchiveImplementation::load_pointer(t, bpis_ptr, finder);
|
---|
71 | }
|
---|
72 | virtual void set_library_version(unsigned int archive_library_version){
|
---|
73 | ArchiveImplementation::set_library_version(archive_library_version);
|
---|
74 | }
|
---|
75 | virtual unsigned int get_library_version() const{
|
---|
76 | return ArchiveImplementation::get_library_version();
|
---|
77 | }
|
---|
78 | virtual unsigned int get_flags() const {
|
---|
79 | return ArchiveImplementation::get_flags();
|
---|
80 | }
|
---|
81 | virtual void delete_created_pointers(){
|
---|
82 | ArchiveImplementation::delete_created_pointers();
|
---|
83 | }
|
---|
84 | virtual void reset_object_address(
|
---|
85 | const void * new_address,
|
---|
86 | const void * old_address
|
---|
87 | ){
|
---|
88 | ArchiveImplementation::reset_object_address(new_address, old_address);
|
---|
89 | }
|
---|
90 | virtual void load_binary(void * t, std::size_t size){
|
---|
91 | ArchiveImplementation::load_binary(t, size);
|
---|
92 | }
|
---|
93 | // primitive types the only ones permitted by polymorphic archives
|
---|
94 | virtual void load(bool & t){
|
---|
95 | ArchiveImplementation::load(t);
|
---|
96 | }
|
---|
97 | virtual void load(char & t){
|
---|
98 | ArchiveImplementation::load(t);
|
---|
99 | }
|
---|
100 | virtual void load(signed char & t){
|
---|
101 | ArchiveImplementation::load(t);
|
---|
102 | }
|
---|
103 | virtual void load(unsigned char & t){
|
---|
104 | ArchiveImplementation::load(t);
|
---|
105 | }
|
---|
106 | #ifndef BOOST_NO_CWCHAR
|
---|
107 | #ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
---|
108 | virtual void load(wchar_t & t){
|
---|
109 | ArchiveImplementation::load(t);
|
---|
110 | }
|
---|
111 | #endif
|
---|
112 | #endif
|
---|
113 | virtual void load(short & t){
|
---|
114 | ArchiveImplementation::load(t);
|
---|
115 | }
|
---|
116 | virtual void load(unsigned short & t){
|
---|
117 | ArchiveImplementation::load(t);
|
---|
118 | }
|
---|
119 | virtual void load(int & t){
|
---|
120 | ArchiveImplementation::load(t);
|
---|
121 | }
|
---|
122 | virtual void load(unsigned int & t){
|
---|
123 | ArchiveImplementation::load(t);
|
---|
124 | }
|
---|
125 | virtual void load(long & t){
|
---|
126 | ArchiveImplementation::load(t);
|
---|
127 | }
|
---|
128 | virtual void load(unsigned long & t){
|
---|
129 | ArchiveImplementation::load(t);
|
---|
130 | }
|
---|
131 | #if !defined(BOOST_NO_INTRINSIC_INT64_T)
|
---|
132 | virtual void load(boost::int64_t & t){
|
---|
133 | ArchiveImplementation::load(t);
|
---|
134 | }
|
---|
135 | virtual void load(boost::uint64_t & t){
|
---|
136 | ArchiveImplementation::load(t);
|
---|
137 | }
|
---|
138 | #endif
|
---|
139 | virtual void load(float & t){
|
---|
140 | ArchiveImplementation::load(t);
|
---|
141 | }
|
---|
142 | virtual void load(double & t){
|
---|
143 | ArchiveImplementation::load(t);
|
---|
144 | }
|
---|
145 | virtual void load(std::string & t){
|
---|
146 | ArchiveImplementation::load(t);
|
---|
147 | }
|
---|
148 | #ifndef BOOST_NO_STD_WSTRING
|
---|
149 | virtual void load(std::wstring & t){
|
---|
150 | ArchiveImplementation::load(t);
|
---|
151 | }
|
---|
152 | #endif
|
---|
153 | // used for xml and other tagged formats default does nothing
|
---|
154 | virtual void load_start(const char * name){
|
---|
155 | ArchiveImplementation::load_start(name);
|
---|
156 | }
|
---|
157 | virtual void load_end(const char * name){
|
---|
158 | ArchiveImplementation::load_end(name);
|
---|
159 | }
|
---|
160 |
|
---|
161 | virtual void register_basic_serializer(const basic_iserializer & bis){
|
---|
162 | ArchiveImplementation::register_basic_serializer(bis);
|
---|
163 | }
|
---|
164 | virtual void lookup_basic_helper(
|
---|
165 | const boost::serialization::extended_type_info * const eti,
|
---|
166 | boost::shared_ptr<void> & sph
|
---|
167 | ){
|
---|
168 | ArchiveImplementation::lookup_basic_helper(eti, sph);
|
---|
169 | }
|
---|
170 | virtual void insert_basic_helper(
|
---|
171 | const boost::serialization::extended_type_info * const eti,
|
---|
172 | boost::shared_ptr<void> & sph
|
---|
173 | ){
|
---|
174 | ArchiveImplementation::insert_basic_helper(eti, sph);
|
---|
175 | }
|
---|
176 | public:
|
---|
177 | // the >> operator
|
---|
178 | template<class T>
|
---|
179 | polymorphic_iarchive & operator>>(T & t){
|
---|
180 | return polymorphic_iarchive::operator>>(t);
|
---|
181 | }
|
---|
182 |
|
---|
183 | // the & operator
|
---|
184 | template<class T>
|
---|
185 | polymorphic_iarchive & operator&(T & t){
|
---|
186 | return polymorphic_iarchive::operator&(t);
|
---|
187 | }
|
---|
188 |
|
---|
189 | // all current archives take a stream as constructor argument
|
---|
190 | template <class _Elem, class _Tr>
|
---|
191 | polymorphic_iarchive_impl(
|
---|
192 | std::basic_istream<_Elem, _Tr> & is,
|
---|
193 | unsigned int flags = 0
|
---|
194 | ) :
|
---|
195 | ArchiveImplementation(is, flags)
|
---|
196 | {}
|
---|
197 | };
|
---|
198 |
|
---|
199 | } // namespace detail
|
---|
200 | } // namespace archive
|
---|
201 | } // namespace boost
|
---|
202 |
|
---|
203 | #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
---|
204 |
|
---|
205 | #endif // BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_IMPL_HPP
|
---|