williamr@2
|
1 |
#ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP
|
williamr@2
|
2 |
#define BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP
|
williamr@2
|
3 |
|
williamr@2
|
4 |
// MS compatible compilers support #pragma once
|
williamr@2
|
5 |
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
williamr@2
|
6 |
# pragma once
|
williamr@2
|
7 |
#endif
|
williamr@2
|
8 |
|
williamr@2
|
9 |
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
williamr@2
|
10 |
// interface_iarchive.hpp
|
williamr@2
|
11 |
|
williamr@2
|
12 |
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
williamr@2
|
13 |
// Use, modification and distribution is subject to the Boost Software
|
williamr@2
|
14 |
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
williamr@2
|
15 |
// http://www.boost.org/LICENSE_1_0.txt)
|
williamr@2
|
16 |
|
williamr@2
|
17 |
// See http://www.boost.org for updates, documentation, and revision history.
|
williamr@2
|
18 |
#include <string>
|
williamr@2
|
19 |
#include <boost/cstdint.hpp>
|
williamr@2
|
20 |
#include <boost/mpl/bool.hpp>
|
williamr@2
|
21 |
#include <boost/archive/detail/auto_link_archive.hpp>
|
williamr@2
|
22 |
#include <boost/archive/detail/iserializer.hpp>
|
williamr@2
|
23 |
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
williamr@2
|
24 |
|
williamr@2
|
25 |
namespace boost {
|
williamr@2
|
26 |
template<class T>
|
williamr@2
|
27 |
class shared_ptr;
|
williamr@2
|
28 |
namespace serialization {
|
williamr@2
|
29 |
class extended_type_info;
|
williamr@2
|
30 |
} // namespace serialization
|
williamr@2
|
31 |
namespace archive {
|
williamr@2
|
32 |
namespace detail {
|
williamr@2
|
33 |
|
williamr@2
|
34 |
class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer;
|
williamr@2
|
35 |
|
williamr@2
|
36 |
template<class Archive>
|
williamr@2
|
37 |
class interface_iarchive
|
williamr@2
|
38 |
{
|
williamr@2
|
39 |
protected:
|
williamr@2
|
40 |
interface_iarchive(){};
|
williamr@2
|
41 |
public:
|
williamr@2
|
42 |
/////////////////////////////////////////////////////////
|
williamr@2
|
43 |
// archive public interface
|
williamr@2
|
44 |
typedef mpl::bool_<true> is_loading;
|
williamr@2
|
45 |
typedef mpl::bool_<false> is_saving;
|
williamr@2
|
46 |
|
williamr@2
|
47 |
// return a pointer to the most derived class
|
williamr@2
|
48 |
Archive * This(){
|
williamr@2
|
49 |
return static_cast<Archive *>(this);
|
williamr@2
|
50 |
}
|
williamr@2
|
51 |
|
williamr@2
|
52 |
template<class T>
|
williamr@2
|
53 |
const basic_pointer_iserializer * register_type(T * = NULL){
|
williamr@2
|
54 |
const basic_pointer_iserializer & bpis =
|
williamr@2
|
55 |
instantiate_pointer_iserializer(
|
williamr@2
|
56 |
static_cast<Archive *>(NULL),
|
williamr@2
|
57 |
static_cast<T *>(NULL)
|
williamr@2
|
58 |
);
|
williamr@2
|
59 |
this->This()->register_basic_serializer(bpis.get_basic_serializer());
|
williamr@2
|
60 |
return & bpis;
|
williamr@2
|
61 |
}
|
williamr@2
|
62 |
void lookup_helper(
|
williamr@2
|
63 |
const boost::serialization::extended_type_info * const eti,
|
williamr@2
|
64 |
boost::shared_ptr<void> & sph
|
williamr@2
|
65 |
){
|
williamr@2
|
66 |
this->This()->lookup_basic_helper(eti, sph);
|
williamr@2
|
67 |
}
|
williamr@2
|
68 |
|
williamr@2
|
69 |
void insert_helper(
|
williamr@2
|
70 |
const boost::serialization::extended_type_info * const eti,
|
williamr@2
|
71 |
shared_ptr<void> & sph
|
williamr@2
|
72 |
){
|
williamr@2
|
73 |
this->This()->insert_basic_helper(eti, sph);
|
williamr@2
|
74 |
}
|
williamr@2
|
75 |
template<class T>
|
williamr@2
|
76 |
Archive & operator>>(T & t){
|
williamr@2
|
77 |
this->This()->load_override(t, 0);
|
williamr@2
|
78 |
return * this->This();
|
williamr@2
|
79 |
}
|
williamr@2
|
80 |
|
williamr@2
|
81 |
// the & operator
|
williamr@2
|
82 |
template<class T>
|
williamr@2
|
83 |
Archive & operator&(T & t){
|
williamr@2
|
84 |
return *(this->This()) >> t;
|
williamr@2
|
85 |
}
|
williamr@2
|
86 |
};
|
williamr@2
|
87 |
|
williamr@2
|
88 |
} // namespace detail
|
williamr@2
|
89 |
} // namespace archive
|
williamr@2
|
90 |
} // namespace boost
|
williamr@2
|
91 |
|
williamr@2
|
92 |
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
williamr@2
|
93 |
|
williamr@2
|
94 |
#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP
|