Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP
0002 #define BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_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 // interface_iarchive.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 #include <cstddef> // NULL
0019 #include <boost/cstdint.hpp>
0020 #include <boost/mpl/bool.hpp>
0021 #include <boost/archive/detail/auto_link_archive.hpp>
0022 #include <boost/archive/detail/iserializer.hpp>
0023 #include <boost/archive/detail/helper_collection.hpp>
0024 #include <boost/serialization/singleton.hpp>
0025 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
0026 
0027 namespace boost {
0028 namespace archive {
0029 namespace detail {
0030 
0031 class basic_pointer_iserializer;
0032 
0033 template<class Archive>
0034 class interface_iarchive
0035 {
0036 protected:
0037     interface_iarchive() {}
0038 public:
0039     /////////////////////////////////////////////////////////
0040     // archive public interface
0041     typedef mpl::bool_<true> is_loading;
0042     typedef mpl::bool_<false> is_saving;
0043 
0044     // return a pointer to the most derived class
0045     Archive * This(){
0046         return static_cast<Archive *>(this);
0047     }
0048 
0049     template<class T>
0050     const basic_pointer_iserializer *
0051     register_type(T * = NULL){
0052         const basic_pointer_iserializer & bpis =
0053             boost::serialization::singleton<
0054                 pointer_iserializer<Archive, T>
0055             >::get_const_instance();
0056         this->This()->register_basic_serializer(bpis.get_basic_serializer());
0057         return & bpis;
0058     }
0059     template<class Helper>
0060     Helper &
0061     get_helper(void * const id = 0){
0062         helper_collection & hc = this->This()->get_helper_collection();
0063         return hc.template find_helper<Helper>(id);
0064     }
0065 
0066     template<class T>
0067     Archive & operator>>(T & t){
0068         this->This()->load_override(t);
0069         return * this->This();
0070     }
0071 
0072     // the & operator
0073     template<class T>
0074     Archive & operator&(T & t){
0075         return *(this->This()) >> t;
0076     }
0077 };
0078 
0079 } // namespace detail
0080 } // namespace archive
0081 } // namespace boost
0082 
0083 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
0084 
0085 #endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP