Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:30

0001 #ifndef BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP
0002 #define BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP
0003 
0004 // MS compatible compilers support #pragma once
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008 
0009 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
0010 // polymorphic_oarchive.hpp
0011 
0012 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
0013 // Use, modification and distribution is subject to the Boost Software
0014 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0015 // http://www.boost.org/LICENSE_1_0.txt)
0016 
0017 //  See http://www.boost.org for updates, documentation, and revision history.
0018 
0019 #include <cstddef> // 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 } // namespace std
0028 #endif
0029 
0030 #include <boost/cstdint.hpp>
0031 #include <boost/archive/detail/oserializer.hpp>
0032 #include <boost/archive/detail/interface_oarchive.hpp>
0033 #include <boost/serialization/nvp.hpp>
0034 #include <boost/archive/detail/register_archive.hpp>
0035 
0036 #include <boost/archive/detail/decl.hpp>
0037 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
0038 
0039 namespace boost {
0040 namespace serialization {
0041     class extended_type_info;
0042 } // namespace serialization
0043 namespace archive {
0044 namespace detail {
0045     class basic_oarchive;
0046     class basic_oserializer;
0047 }
0048 
0049 class polymorphic_oarchive;
0050 
0051 class BOOST_SYMBOL_VISIBLE polymorphic_oarchive_impl :
0052     public detail::interface_oarchive<polymorphic_oarchive>
0053 {
0054 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
0055 public:
0056 #else
0057     friend class detail::interface_oarchive<polymorphic_oarchive>;
0058     friend class save_access;
0059 #endif
0060     // primitive types the only ones permitted by polymorphic archives
0061     virtual void save(const bool t) = 0;
0062 
0063     virtual void save(const char t) = 0;
0064     virtual void save(const signed char t) = 0;
0065     virtual void save(const unsigned char t) = 0;
0066     #ifndef BOOST_NO_CWCHAR
0067     #ifndef BOOST_NO_INTRINSIC_WCHAR_T
0068     virtual void save(const wchar_t t) = 0;
0069     #endif
0070     #endif
0071     virtual void save(const short t) = 0;
0072     virtual void save(const unsigned short t) = 0;
0073     virtual void save(const int t) = 0;
0074     virtual void save(const unsigned int t) = 0;
0075     virtual void save(const long t) = 0;
0076     virtual void save(const unsigned long t) = 0;
0077 
0078     #if defined(BOOST_HAS_LONG_LONG)
0079     virtual void save(const boost::long_long_type t) = 0;
0080     virtual void save(const boost::ulong_long_type t) = 0;
0081     #elif defined(BOOST_HAS_MS_INT64)
0082     virtual void save(const __int64 t) = 0;
0083     virtual void save(const unsigned __int64 t) = 0;
0084     #endif
0085 
0086     virtual void save(const float t) = 0;
0087     virtual void save(const double t) = 0;
0088 
0089     // string types are treated as primitives
0090     virtual void save(const std::string & t) = 0;
0091     #ifndef BOOST_NO_STD_WSTRING
0092     virtual void save(const std::wstring & t) = 0;
0093     #endif
0094 
0095     virtual void save_null_pointer() = 0;
0096     // used for xml and other tagged formats
0097     virtual void save_start(const char * name) = 0;
0098     virtual void save_end(const char * name) = 0;
0099     virtual void register_basic_serializer(const detail::basic_oserializer & bos) = 0;
0100     virtual detail::helper_collection & get_helper_collection() = 0;
0101 
0102     virtual void end_preamble() = 0;
0103 
0104     // msvc and borland won't automatically pass these to the base class so
0105     // make it explicit here
0106     template<class T>
0107     void save_override(T & t)
0108     {
0109         archive::save(* this->This(), t);
0110     }
0111     // special treatment for name-value pairs.
0112     template<class T>
0113     void save_override(
0114             const ::boost::serialization::nvp< T > & t
0115         ){
0116         save_start(t.name());
0117         archive::save(* this->This(), t.const_value());
0118         save_end(t.name());
0119     }
0120 protected:
0121     virtual ~polymorphic_oarchive_impl() {}
0122 public:
0123     // utility functions implemented by all legal archives
0124     virtual unsigned int get_flags() const = 0;
0125     virtual boost::serialization::library_version_type get_library_version() const = 0;
0126     virtual void save_binary(const void * t, std::size_t size) = 0;
0127 
0128     virtual void save_object(
0129         const void *x,
0130         const detail::basic_oserializer & bos
0131     ) = 0;
0132     virtual void save_pointer(
0133         const void * t,
0134         const detail::basic_pointer_oserializer * bpos_ptr
0135     ) = 0;
0136 };
0137 
0138 // note: preserve naming symmetry
0139 class BOOST_SYMBOL_VISIBLE polymorphic_oarchive :
0140     public polymorphic_oarchive_impl
0141 {
0142 public:
0143     ~polymorphic_oarchive() BOOST_OVERRIDE {}
0144 };
0145 
0146 } // namespace archive
0147 } // namespace boost
0148 
0149 // required by export
0150 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_oarchive)
0151 
0152 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
0153 
0154 #endif // BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP