File indexing completed on 2025-01-18 09:28:27
0001 #ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP
0002 #define BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_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/detail/workaround.hpp>
0022
0023 #include <boost/archive/detail/auto_link_archive.hpp>
0024 #include <boost/archive/detail/oserializer.hpp>
0025 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
0026
0027 #include <boost/serialization/singleton.hpp>
0028
0029 namespace boost {
0030 namespace archive {
0031 namespace detail {
0032
0033 class basic_pointer_oserializer;
0034
0035 template<class Archive>
0036 class interface_oarchive
0037 {
0038 protected:
0039 interface_oarchive() {}
0040 public:
0041
0042
0043 typedef mpl::bool_<false> is_loading;
0044 typedef mpl::bool_<true> is_saving;
0045
0046
0047 Archive * This(){
0048 return static_cast<Archive*>(this);
0049 }
0050
0051 template<class T>
0052 const basic_pointer_oserializer *
0053 register_type(const T * = NULL){
0054 const basic_pointer_oserializer & bpos =
0055 boost::serialization::singleton<
0056 pointer_oserializer<Archive, T>
0057 >::get_const_instance();
0058 this->This()->register_basic_serializer(bpos.get_basic_serializer());
0059 return & bpos;
0060 }
0061
0062 template<class Helper>
0063 Helper &
0064 get_helper(void * const id = 0){
0065 helper_collection & hc = this->This()->get_helper_collection();
0066 return hc.template find_helper<Helper>(id);
0067 }
0068
0069 template<class T>
0070 Archive & operator<<(const T & t){
0071 this->This()->save_override(t);
0072 return * this->This();
0073 }
0074
0075
0076 template<class T>
0077 Archive & operator&(const T & t){
0078 return * this ->This() << t;
0079 }
0080 };
0081
0082 }
0083 }
0084 }
0085
0086 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
0087
0088 #endif