Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / archive / detail / interface_oarchive.hpp @ 2486

History | View | Annotate | Download (2.4 kB)

1
#ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP
2
#define BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_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_oarchive.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

    
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
25

    
26
#include <boost/serialization/singleton.hpp>
27

    
28
namespace boost {
29
namespace archive {
30
namespace detail {
31

    
32
class basic_pointer_oserializer;
33

    
34
template<class Archive>
35
class interface_oarchive 
36
{
37
protected:
38
    interface_oarchive(){};
39
public:
40
    /////////////////////////////////////////////////////////
41
    // archive public interface
42
    typedef mpl::bool_<false> is_loading;
43
    typedef mpl::bool_<true> is_saving;
44

    
45
    // return a pointer to the most derived class
46
    Archive * This(){
47
        return static_cast<Archive *>(this);
48
    }
49

    
50
    template<class T>
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());
58
        return & bpos;
59
    }
60
    
61
    template<class Helper>
62
    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);
66
    }
67

    
68
    template<class T>
69
    Archive & operator<<(const T & t){
70
        this->This()->save_override(t);
71
        return * this->This();
72
    }
73
    
74
    // the & operator 
75
    template<class T>
76
    Archive & operator&(const T & t){
77
        return * this ->This() << t;
78
    }
79
};
80

    
81
} // namespace detail
82
} // namespace archive
83
} // namespace boost
84

    
85
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
86

    
87
#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP