1 #ifndef BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP
2 #define BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP
4 // MS compatible compilers support #pragma once
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // polymorphic_iarchive.hpp
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)
17 // See http://www.boost.org for updates, documentation, and revision history.
19 #include <cstddef> // std::size_t
20 #include <climits> // ULONG_MAX
23 #include <boost/config.hpp>
24 #if defined(BOOST_NO_STDC_NAMESPACE)
30 #include <boost/cstdint.hpp>
32 #include <boost/archive/detail/iserializer.hpp>
33 #include <boost/archive/detail/interface_iarchive.hpp>
34 #include <boost/serialization/library_version_type.hpp>
35 #include <boost/serialization/nvp.hpp>
36 #include <boost/archive/detail/register_archive.hpp>
38 #include <boost/archive/detail/decl.hpp>
39 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
42 namespace serialization {
43 class extended_type_info;
44 } // namespace serialization
48 class basic_iserializer;
51 class polymorphic_iarchive;
53 class BOOST_SYMBOL_VISIBLE polymorphic_iarchive_impl :
54 public detail::interface_iarchive<polymorphic_iarchive>
56 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
59 friend class detail::interface_iarchive<polymorphic_iarchive>;
60 friend class load_access;
62 // primitive types the only ones permitted by polymorphic archives
63 virtual void load(bool & t) = 0;
65 virtual void load(char & t) = 0;
66 virtual void load(signed char & t) = 0;
67 virtual void load(unsigned char & t) = 0;
68 #ifndef BOOST_NO_CWCHAR
69 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
70 virtual void load(wchar_t & t) = 0;
73 virtual void load(short & t) = 0;
74 virtual void load(unsigned short & t) = 0;
75 virtual void load(int & t) = 0;
76 virtual void load(unsigned int & t) = 0;
77 virtual void load(long & t) = 0;
78 virtual void load(unsigned long & t) = 0;
80 #if defined(BOOST_HAS_LONG_LONG)
81 virtual void load(boost::long_long_type & t) = 0;
82 virtual void load(boost::ulong_long_type & t) = 0;
83 #elif defined(BOOST_HAS_MS_INT64)
84 virtual void load(__int64 & t) = 0;
85 virtual void load(unsigned __int64 & t) = 0;
88 virtual void load(float & t) = 0;
89 virtual void load(double & t) = 0;
91 // string types are treated as primitives
92 virtual void load(std::string & t) = 0;
93 #ifndef BOOST_NO_STD_WSTRING
94 virtual void load(std::wstring & t) = 0;
97 // used for xml and other tagged formats
98 virtual void load_start(const char * name) = 0;
99 virtual void load_end(const char * name) = 0;
100 virtual void register_basic_serializer(const detail::basic_iserializer & bis) = 0;
101 virtual detail::helper_collection & get_helper_collection() = 0;
103 // msvc and borland won't automatically pass these to the base class so
104 // make it explicit here
106 void load_override(T & t)
108 archive::load(* this->This(), t);
110 // special treatment for name-value pairs.
113 const boost::serialization::nvp< T > & t
115 load_start(t.name());
116 archive::load(* this->This(), t.value());
120 virtual ~polymorphic_iarchive_impl() {}
122 // utility function implemented by all legal archives
123 virtual void set_library_version(
124 boost::serialization::library_version_type archive_library_version
126 virtual boost::serialization::library_version_type get_library_version() const = 0;
127 virtual unsigned int get_flags() const = 0;
128 virtual void delete_created_pointers() = 0;
129 virtual void reset_object_address(
130 const void * new_address,
131 const void * old_address
134 virtual void load_binary(void * t, std::size_t size) = 0;
136 // these are used by the serialization library implementation.
137 virtual void load_object(
139 const detail::basic_iserializer & bis
141 virtual const detail::basic_pointer_iserializer * load_pointer(
143 const detail::basic_pointer_iserializer * bpis_ptr,
144 const detail::basic_pointer_iserializer * (*finder)(
145 const boost::serialization::extended_type_info & type
150 } // namespace archive
153 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
158 class BOOST_SYMBOL_VISIBLE polymorphic_iarchive :
159 public polymorphic_iarchive_impl
162 ~polymorphic_iarchive() BOOST_OVERRIDE {}
165 } // namespace archive
168 // required by export
169 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_iarchive)
171 #endif // BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP