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
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
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
0041 typedef mpl::bool_<true> is_loading;
0042 typedef mpl::bool_<false> is_saving;
0043
0044
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
0073 template<class T>
0074 Archive & operator&(T & t){
0075 return *(this->This()) >> t;
0076 }
0077 };
0078
0079 }
0080 }
0081 }
0082
0083 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
0084
0085 #endif