]> git.sesse.net Git - casparcg/blob - dependencies/boost/boost/archive/detail/interface_iarchive.hpp
Merge pull request #219 from CasparCG/loadbg_seek_bugfix
[casparcg] / dependencies / boost / boost / archive / detail / interface_iarchive.hpp
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) && (_MSC_VER >= 1020)
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/serialization/singleton.hpp>
24 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
25
26 namespace boost {
27 namespace archive {
28 namespace detail {
29
30 class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer;
31
32 template<class Archive>
33 class interface_iarchive 
34 {
35 protected:
36     interface_iarchive(){};
37 public:
38     /////////////////////////////////////////////////////////
39     // archive public interface
40     typedef mpl::bool_<true> is_loading;
41     typedef mpl::bool_<false> is_saving;
42
43     // return a pointer to the most derived class
44     Archive * This(){
45         return static_cast<Archive *>(this);
46     }
47
48     template<class T>
49     const basic_pointer_iserializer * 
50     register_type(T * = NULL){
51         const basic_pointer_iserializer & bpis =
52             boost::serialization::singleton<
53                 pointer_iserializer<Archive, T> 
54             >::get_const_instance();
55         this->This()->register_basic_serializer(bpis.get_basic_serializer());
56         return & bpis;
57     }
58     template<class T>
59     Archive & operator>>(T & t){
60         this->This()->load_override(t, 0);
61         return * this->This();
62     }
63
64     // the & operator 
65     template<class T>
66     Archive & operator&(T & t){
67         return *(this->This()) >> t;
68     }
69 };
70
71 } // namespace detail
72 } // namespace archive
73 } // namespace boost
74
75 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
76
77 #endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP