File indexing completed on 2025-01-18 09:28:30
0001 #ifndef BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP
0002 #define BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP
0003
0004
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include <cstddef> // std::size_t
0020 #include <climits> // ULONG_MAX
0021 #include <string>
0022
0023 #include <boost/config.hpp>
0024 #if defined(BOOST_NO_STDC_NAMESPACE)
0025 namespace std{
0026 using ::size_t;
0027 }
0028 #endif
0029
0030 #include <boost/cstdint.hpp>
0031
0032 #include <boost/archive/detail/iserializer.hpp>
0033 #include <boost/archive/detail/interface_iarchive.hpp>
0034 #include <boost/serialization/library_version_type.hpp>
0035 #include <boost/serialization/nvp.hpp>
0036 #include <boost/archive/detail/register_archive.hpp>
0037
0038 #include <boost/archive/detail/decl.hpp>
0039 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
0040
0041 namespace boost {
0042 namespace serialization {
0043 class extended_type_info;
0044 }
0045 namespace archive {
0046 namespace detail {
0047 class basic_iarchive;
0048 class basic_iserializer;
0049 }
0050
0051 class polymorphic_iarchive;
0052
0053 class BOOST_SYMBOL_VISIBLE polymorphic_iarchive_impl :
0054 public detail::interface_iarchive<polymorphic_iarchive>
0055 {
0056 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
0057 public:
0058 #else
0059 friend class detail::interface_iarchive<polymorphic_iarchive>;
0060 friend class load_access;
0061 #endif
0062
0063 virtual void load(bool & t) = 0;
0064
0065 virtual void load(char & t) = 0;
0066 virtual void load(signed char & t) = 0;
0067 virtual void load(unsigned char & t) = 0;
0068 #ifndef BOOST_NO_CWCHAR
0069 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
0070 virtual void load(wchar_t & t) = 0;
0071 #endif
0072 #endif
0073 virtual void load(short & t) = 0;
0074 virtual void load(unsigned short & t) = 0;
0075 virtual void load(int & t) = 0;
0076 virtual void load(unsigned int & t) = 0;
0077 virtual void load(long & t) = 0;
0078 virtual void load(unsigned long & t) = 0;
0079
0080 #if defined(BOOST_HAS_LONG_LONG)
0081 virtual void load(boost::long_long_type & t) = 0;
0082 virtual void load(boost::ulong_long_type & t) = 0;
0083 #elif defined(BOOST_HAS_MS_INT64)
0084 virtual void load(__int64 & t) = 0;
0085 virtual void load(unsigned __int64 & t) = 0;
0086 #endif
0087
0088 virtual void load(float & t) = 0;
0089 virtual void load(double & t) = 0;
0090
0091
0092 virtual void load(std::string & t) = 0;
0093 #ifndef BOOST_NO_STD_WSTRING
0094 virtual void load(std::wstring & t) = 0;
0095 #endif
0096
0097
0098 virtual void load_start(const char * name) = 0;
0099 virtual void load_end(const char * name) = 0;
0100 virtual void register_basic_serializer(const detail::basic_iserializer & bis) = 0;
0101 virtual detail::helper_collection & get_helper_collection() = 0;
0102
0103
0104
0105 template<class T>
0106 void load_override(T & t)
0107 {
0108 archive::load(* this->This(), t);
0109 }
0110
0111 template<class T>
0112 void load_override(
0113 const boost::serialization::nvp< T > & t
0114 ){
0115 load_start(t.name());
0116 archive::load(* this->This(), t.value());
0117 load_end(t.name());
0118 }
0119 protected:
0120 virtual ~polymorphic_iarchive_impl() {}
0121 public:
0122
0123 virtual void set_library_version(
0124 boost::serialization::library_version_type archive_library_version
0125 ) = 0;
0126 virtual boost::serialization::library_version_type get_library_version() const = 0;
0127 virtual unsigned int get_flags() const = 0;
0128 virtual void delete_created_pointers() = 0;
0129 virtual void reset_object_address(
0130 const void * new_address,
0131 const void * old_address
0132 ) = 0;
0133
0134 virtual void load_binary(void * t, std::size_t size) = 0;
0135
0136
0137 virtual void load_object(
0138 void *t,
0139 const detail::basic_iserializer & bis
0140 ) = 0;
0141 virtual const detail::basic_pointer_iserializer * load_pointer(
0142 void * & t,
0143 const detail::basic_pointer_iserializer * bpis_ptr,
0144 const detail::basic_pointer_iserializer * (*finder)(
0145 const boost::serialization::extended_type_info & type
0146 )
0147 ) = 0;
0148 };
0149
0150 }
0151 }
0152
0153 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
0154
0155 namespace boost {
0156 namespace archive {
0157
0158 class BOOST_SYMBOL_VISIBLE polymorphic_iarchive :
0159 public polymorphic_iarchive_impl
0160 {
0161 public:
0162 ~polymorphic_iarchive() BOOST_OVERRIDE {}
0163 };
0164
0165 }
0166 }
0167
0168
0169 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_iarchive)
0170
0171 #endif