Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_ROUTE_HPP
0002 #define BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_ROUTE_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_route.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 <string>
0020 #include <ostream>
0021 #include <cstddef> // size_t
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/integer_traits.hpp>
0032 #include <boost/archive/polymorphic_oarchive.hpp>
0033 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
0034 
0035 namespace boost {
0036 namespace serialization {
0037     class extended_type_info;
0038 } // namespace serialization
0039 namespace archive {
0040 namespace detail{
0041 
0042 class basic_oserializer;
0043 class basic_pointer_oserializer;
0044 
0045 #ifdef BOOST_MSVC
0046 #  pragma warning(push)
0047 #  pragma warning(disable : 4511 4512)
0048 #endif
0049 
0050 template<class ArchiveImplementation>
0051 class polymorphic_oarchive_route :
0052     public polymorphic_oarchive,
0053     // note: gcc dynamic cross cast fails if the the derivation below is
0054     // not public.  I think this is a mistake.
0055     public /*protected*/ ArchiveImplementation
0056 {
0057 private:
0058     // these are used by the serialization library.
0059     void save_object(
0060         const void *x,
0061         const detail::basic_oserializer & bos
0062     ) BOOST_OVERRIDE {
0063         ArchiveImplementation::save_object(x, bos);
0064     }
0065     void save_pointer(
0066         const void * t,
0067         const detail::basic_pointer_oserializer * bpos_ptr
0068     ) BOOST_OVERRIDE {
0069         ArchiveImplementation::save_pointer(t, bpos_ptr);
0070     }
0071     void save_null_pointer() BOOST_OVERRIDE {
0072         ArchiveImplementation::save_null_pointer();
0073     }
0074     // primitive types the only ones permitted by polymorphic archives
0075     void save(const bool t) BOOST_OVERRIDE {
0076         ArchiveImplementation::save(t);
0077     }
0078     void save(const char t) BOOST_OVERRIDE {
0079         ArchiveImplementation::save(t);
0080     }
0081     void save(const signed char t) BOOST_OVERRIDE {
0082         ArchiveImplementation::save(t);
0083     }
0084     void save(const unsigned char t) BOOST_OVERRIDE {
0085         ArchiveImplementation::save(t);
0086     }
0087     #ifndef BOOST_NO_CWCHAR
0088     #ifndef BOOST_NO_INTRINSIC_WCHAR_T
0089     void save(const wchar_t t) BOOST_OVERRIDE {
0090         ArchiveImplementation::save(t);
0091     }
0092     #endif
0093     #endif
0094     void save(const short t) BOOST_OVERRIDE {
0095         ArchiveImplementation::save(t);
0096     }
0097     void save(const unsigned short t) BOOST_OVERRIDE {
0098         ArchiveImplementation::save(t);
0099     }
0100     void save(const int t) BOOST_OVERRIDE {
0101         ArchiveImplementation::save(t);
0102     }
0103     void save(const unsigned int t) BOOST_OVERRIDE {
0104         ArchiveImplementation::save(t);
0105     }
0106     void save(const long t) BOOST_OVERRIDE {
0107         ArchiveImplementation::save(t);
0108     }
0109     void save(const unsigned long t) BOOST_OVERRIDE {
0110         ArchiveImplementation::save(t);
0111     }
0112     #if defined(BOOST_HAS_LONG_LONG)
0113     void save(const boost::long_long_type t) BOOST_OVERRIDE {
0114         ArchiveImplementation::save(t);
0115     }
0116     void save(const boost::ulong_long_type t) BOOST_OVERRIDE {
0117         ArchiveImplementation::save(t);
0118     }
0119     #elif defined(BOOST_HAS_MS_INT64)
0120     void save(const boost::int64_t t) BOOST_OVERRIDE {
0121         ArchiveImplementation::save(t);
0122     }
0123     void save(const boost::uint64_t t) BOOST_OVERRIDE {
0124         ArchiveImplementation::save(t);
0125     }
0126     #endif
0127     void save(const float t) BOOST_OVERRIDE {
0128         ArchiveImplementation::save(t);
0129     }
0130     void save(const double t) BOOST_OVERRIDE {
0131         ArchiveImplementation::save(t);
0132     }
0133     void save(const std::string & t) BOOST_OVERRIDE {
0134         ArchiveImplementation::save(t);
0135     }
0136     #ifndef BOOST_NO_STD_WSTRING
0137     void save(const std::wstring & t) BOOST_OVERRIDE {
0138         ArchiveImplementation::save(t);
0139     }
0140     #endif
0141     boost::serialization::library_version_type get_library_version() const BOOST_OVERRIDE {
0142         return ArchiveImplementation::get_library_version();
0143     }
0144     unsigned int get_flags() const BOOST_OVERRIDE {
0145         return ArchiveImplementation::get_flags();
0146     }
0147     void save_binary(const void * t, std::size_t size) BOOST_OVERRIDE {
0148         ArchiveImplementation::save_binary(t, size);
0149     }
0150     // used for xml and other tagged formats default does nothing
0151     void save_start(const char * name) BOOST_OVERRIDE {
0152         ArchiveImplementation::save_start(name);
0153     }
0154     void save_end(const char * name) BOOST_OVERRIDE {
0155         ArchiveImplementation::save_end(name);
0156     }
0157     void end_preamble() BOOST_OVERRIDE {
0158         ArchiveImplementation::end_preamble();
0159     }
0160     void register_basic_serializer(const detail::basic_oserializer & bos) BOOST_OVERRIDE {
0161         ArchiveImplementation::register_basic_serializer(bos);
0162     }
0163     helper_collection &
0164     get_helper_collection() BOOST_OVERRIDE {
0165         return ArchiveImplementation::get_helper_collection();
0166     }
0167 public:
0168     // this can't be inherited because they appear in multiple
0169     // parents
0170     typedef mpl::bool_<false> is_loading;
0171     typedef mpl::bool_<true> is_saving;
0172     // the << operator
0173     template<class T>
0174     polymorphic_oarchive & operator<<(T & t){
0175         return polymorphic_oarchive::operator<<(t);
0176     }
0177     // the & operator
0178     template<class T>
0179     polymorphic_oarchive & operator&(T & t){
0180         return polymorphic_oarchive::operator&(t);
0181     }
0182     // register type function
0183     template<class T>
0184     const basic_pointer_oserializer *
0185     register_type(T * t = NULL){
0186         return ArchiveImplementation::register_type(t);
0187     }
0188     // all current archives take a stream as constructor argument
0189     template <class _Elem, class _Tr>
0190     polymorphic_oarchive_route(
0191         std::basic_ostream<_Elem, _Tr> & os,
0192         unsigned int flags = 0
0193     ) :
0194         ArchiveImplementation(os, flags)
0195     {}
0196     ~polymorphic_oarchive_route() BOOST_OVERRIDE {}
0197 };
0198 
0199 } // namespace detail
0200 } // namespace archive
0201 } // namespace boost
0202 
0203 #ifdef BOOST_MSVC
0204 #pragma warning(pop)
0205 #endif
0206 
0207 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
0208 
0209 #endif // BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_DISPATCH_HPP