1#ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP
2#define BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP
3
4// MS compatible compilers support #pragma once
5#if defined(_MSC_VER)
6# pragma once
7#endif
8
9/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10// interface_iarchive.hpp
11
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)
16
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>
21#include <boost/archive/detail/auto_link_archive.hpp>
22#include <boost/archive/detail/iserializer.hpp>
23#include <boost/archive/detail/helper_collection.hpp>
24#include <boost/serialization/singleton.hpp>
25#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
26
27namespace boost {
28namespace archive {
29namespace detail {
30
31class basic_pointer_iserializer;
32
33template<class Archive>
34class interface_iarchive
35{
36protected:
37 interface_iarchive() {}
38public:
39 /////////////////////////////////////////////////////////
40 // archive public interface
41 typedef mpl::bool_<true> is_loading;
42 typedef mpl::bool_<false> is_saving;
43
44 // return a pointer to the most derived class
45 Archive * This(){
46 return static_cast<Archive *>(this);
47 }
48
49 template<class T>
50 const basic_pointer_iserializer *
51 register_type(T * = NULL){
52 const basic_pointer_iserializer & bpis =
53 boost::serialization::singleton<
54 pointer_iserializer<Archive, T>
55 >::get_const_instance();
56 this->This()->register_basic_serializer(bpis.get_basic_serializer());
57 return & bpis;
58 }
59 template<class Helper>
60 Helper &
61 get_helper(void * const id = 0){
62 helper_collection & hc = this->This()->get_helper_collection();
63 return hc.template find_helper<Helper>(id);
64 }
65
66 template<class T>
67 Archive & operator>>(T & t){
68 this->This()->load_override(t);
69 return * this->This();
70 }
71
72 // the & operator
73 template<class T>
74 Archive & operator&(T & t){
75 return *(this->This()) >> t;
76 }
77};
78
79} // namespace detail
80} // namespace archive
81} // namespace boost
82
83#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
84
85#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP
86

source code of boost/libs/serialization/include/boost/archive/detail/interface_iarchive.hpp