1 #ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP
2 #define BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP
4 // MS compatible compilers support #pragma once
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // interface_oarchive.hpp
12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13 // Use, modification and distribution is subject to the Boost Software
14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
17 // See http://www.boost.org for updates, documentation, and revision history.
18 #include <cstddef> // NULL
19 #include <boost/cstdint.hpp>
20 #include <boost/mpl/bool.hpp>
22 #include <boost/archive/detail/auto_link_archive.hpp>
23 #include <boost/archive/detail/oserializer.hpp>
24 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
26 #include <boost/serialization/singleton.hpp>
32 class basic_pointer_oserializer;
34 template<class Archive>
35 class interface_oarchive
38 interface_oarchive(){};
40 /////////////////////////////////////////////////////////
41 // archive public interface
42 typedef mpl::bool_<false> is_loading;
43 typedef mpl::bool_<true> is_saving;
45 // return a pointer to the most derived class
47 return static_cast<Archive *>(this);
51 const basic_pointer_oserializer *
52 register_type(const T * = NULL){
53 const basic_pointer_oserializer & bpos =
54 boost::serialization::singleton<
55 pointer_oserializer<Archive, T>
56 >::get_const_instance();
57 this->This()->register_basic_serializer(bpos.get_basic_serializer());
61 template<class Helper>
63 get_helper(void * const id = 0){
64 helper_collection & hc = this->This()->get_helper_collection();
65 return hc.template find_helper<Helper>(id);
69 Archive & operator<<(const T & t){
70 this->This()->save_override(t);
71 return * this->This();
76 Archive & operator&(const T & t){
77 return * this ->This() << t;
82 } // namespace archive
85 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
87 #endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP