Statistics
| Revision:

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

History | View | Annotate | Download (6.7 kB)

1 2486 sjacqu01
#ifndef BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP
2 2486 sjacqu01
#define BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP
3 2486 sjacqu01
4 2486 sjacqu01
// MS compatible compilers support #pragma once
5 2486 sjacqu01
#if defined(_MSC_VER)
6 2486 sjacqu01
# pragma once
7 2486 sjacqu01
#endif
8 2486 sjacqu01
9 2486 sjacqu01
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 2486 sjacqu01
// basic_binary_iarchive.hpp
11 2486 sjacqu01
//
12 2486 sjacqu01
// archives stored as native binary - this should be the fastest way
13 2486 sjacqu01
// to archive the state of a group of obects.  It makes no attempt to
14 2486 sjacqu01
// convert to any canonical form.
15 2486 sjacqu01
16 2486 sjacqu01
// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE
17 2486 sjacqu01
// ON PLATFORM APART FROM THE ONE THEY ARE CREATED ON
18 2486 sjacqu01
19 2486 sjacqu01
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
20 2486 sjacqu01
// Use, modification and distribution is subject to the Boost Software
21 2486 sjacqu01
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
22 2486 sjacqu01
// http://www.boost.org/LICENSE_1_0.txt)
23 2486 sjacqu01
24 2486 sjacqu01
//  See http://www.boost.org for updates, documentation, and revision history.
25 2486 sjacqu01
26 2486 sjacqu01
#include <boost/config.hpp>
27 2486 sjacqu01
#include <boost/detail/workaround.hpp>
28 2486 sjacqu01
29 2486 sjacqu01
#include <boost/archive/basic_archive.hpp>
30 2486 sjacqu01
#include <boost/archive/detail/common_iarchive.hpp>
31 2486 sjacqu01
#include <boost/serialization/collection_size_type.hpp>
32 2486 sjacqu01
#include <boost/serialization/string.hpp>
33 2486 sjacqu01
#include <boost/serialization/item_version_type.hpp>
34 2486 sjacqu01
#include <boost/integer_traits.hpp>
35 2486 sjacqu01
36 2486 sjacqu01
#ifdef BOOST_MSVC
37 2486 sjacqu01
#  pragma warning(push)
38 2486 sjacqu01
#  pragma warning(disable : 4511 4512)
39 2486 sjacqu01
#endif
40 2486 sjacqu01
41 2486 sjacqu01
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
42 2486 sjacqu01
43 2486 sjacqu01
namespace boost {
44 2486 sjacqu01
namespace archive {
45 2486 sjacqu01
46 2486 sjacqu01
namespace detail {
47 2486 sjacqu01
    template<class Archive> class interface_iarchive;
48 2486 sjacqu01
} // namespace detail
49 2486 sjacqu01
50 2486 sjacqu01
/////////////////////////////////////////////////////////////////////////
51 2486 sjacqu01
// class basic_binary_iarchive - read serialized objects from a input binary stream
52 2486 sjacqu01
template<class Archive>
53 2486 sjacqu01
class BOOST_SYMBOL_VISIBLE basic_binary_iarchive :
54 2486 sjacqu01
    public detail::common_iarchive<Archive>
55 2486 sjacqu01
{
56 2486 sjacqu01
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
57 2486 sjacqu01
public:
58 2486 sjacqu01
#else
59 2486 sjacqu01
protected:
60 2486 sjacqu01
    #if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
61 2486 sjacqu01
        // for some inexplicable reason insertion of "class" generates compile erro
62 2486 sjacqu01
        // on msvc 7.1
63 2486 sjacqu01
        friend detail::interface_iarchive<Archive>;
64 2486 sjacqu01
    #else
65 2486 sjacqu01
        friend class detail::interface_iarchive<Archive>;
66 2486 sjacqu01
    #endif
67 2486 sjacqu01
#endif
68 2486 sjacqu01
    // intermediate level to support override of operators
69 2486 sjacqu01
    // fot templates in the absence of partial function
70 2486 sjacqu01
    // template ordering. If we get here pass to base class
71 2486 sjacqu01
    // note extra nonsense to sneak it pass the borland compiers
72 2486 sjacqu01
    typedef detail::common_iarchive<Archive> detail_common_iarchive;
73 2486 sjacqu01
    template<class T>
74 2486 sjacqu01
    void load_override(T & t){
75 2486 sjacqu01
      this->detail_common_iarchive::load_override(t);
76 2486 sjacqu01
    }
77 2486 sjacqu01
78 2486 sjacqu01
    // include these to trap a change in binary format which
79 2486 sjacqu01
    // isn't specifically handled
80 2486 sjacqu01
    // upto 32K classes
81 2486 sjacqu01
    BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t));
82 2486 sjacqu01
    BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t));
83 2486 sjacqu01
    // upto 2G objects
84 2486 sjacqu01
    BOOST_STATIC_ASSERT(sizeof(object_id_type) == sizeof(uint_least32_t));
85 2486 sjacqu01
    BOOST_STATIC_ASSERT(sizeof(object_reference_type) == sizeof(uint_least32_t));
86 2486 sjacqu01
87 2486 sjacqu01
    // binary files don't include the optional information
88 2486 sjacqu01
    void load_override(class_id_optional_type & /* t */){}
89 2486 sjacqu01
90 2486 sjacqu01
    void load_override(tracking_type & t, int /*version*/){
91 2486 sjacqu01
        library_version_type lvt = this->get_library_version();
92 2486 sjacqu01
        if(boost::archive::library_version_type(6) < lvt){
93 2486 sjacqu01
            int_least8_t x=0;
94 2486 sjacqu01
            * this->This() >> x;
95 2486 sjacqu01
            t = boost::archive::tracking_type(x);
96 2486 sjacqu01
        }
97 2486 sjacqu01
        else{
98 2486 sjacqu01
            bool x=0;
99 2486 sjacqu01
            * this->This() >> x;
100 2486 sjacqu01
            t = boost::archive::tracking_type(x);
101 2486 sjacqu01
        }
102 2486 sjacqu01
    }
103 2486 sjacqu01
    void load_override(class_id_type & t){
104 2486 sjacqu01
        library_version_type lvt = this->get_library_version();
105 2486 sjacqu01
        if(boost::archive::library_version_type(7) < lvt){
106 2486 sjacqu01
            this->detail_common_iarchive::load_override(t);
107 2486 sjacqu01
        }
108 2486 sjacqu01
        else
109 2486 sjacqu01
        if(boost::archive::library_version_type(6) < lvt){
110 2486 sjacqu01
            int_least16_t x=0;
111 2486 sjacqu01
            * this->This() >> x;
112 2486 sjacqu01
            t = boost::archive::class_id_type(x);
113 2486 sjacqu01
        }
114 2486 sjacqu01
        else{
115 2486 sjacqu01
            int x=0;
116 2486 sjacqu01
            * this->This() >> x;
117 2486 sjacqu01
            t = boost::archive::class_id_type(x);
118 2486 sjacqu01
        }
119 2486 sjacqu01
    }
120 2486 sjacqu01
    void load_override(class_id_reference_type & t){
121 2486 sjacqu01
        load_override(static_cast<class_id_type &>(t));
122 2486 sjacqu01
    }
123 2486 sjacqu01
124 2486 sjacqu01
    void load_override(version_type & t){
125 2486 sjacqu01
        library_version_type lvt = this->get_library_version();
126 2486 sjacqu01
        if(boost::archive::library_version_type(7) < lvt){
127 2486 sjacqu01
            this->detail_common_iarchive::load_override(t);
128 2486 sjacqu01
        }
129 2486 sjacqu01
        else
130 2486 sjacqu01
        if(boost::archive::library_version_type(6) < lvt){
131 2486 sjacqu01
            uint_least8_t x=0;
132 2486 sjacqu01
            * this->This() >> x;
133 2486 sjacqu01
            t = boost::archive::version_type(x);
134 2486 sjacqu01
        }
135 2486 sjacqu01
        else
136 2486 sjacqu01
        if(boost::archive::library_version_type(5) < lvt){
137 2486 sjacqu01
            uint_least16_t x=0;
138 2486 sjacqu01
            * this->This() >> x;
139 2486 sjacqu01
            t = boost::archive::version_type(x);
140 2486 sjacqu01
        }
141 2486 sjacqu01
        else
142 2486 sjacqu01
        if(boost::archive::library_version_type(2) < lvt){
143 2486 sjacqu01
            // upto 255 versions
144 2486 sjacqu01
            unsigned char x=0;
145 2486 sjacqu01
            * this->This() >> x;
146 2486 sjacqu01
            t = version_type(x);
147 2486 sjacqu01
        }
148 2486 sjacqu01
        else{
149 2486 sjacqu01
            unsigned int x=0;
150 2486 sjacqu01
            * this->This() >> x;
151 2486 sjacqu01
            t = boost::archive::version_type(x);
152 2486 sjacqu01
        }
153 2486 sjacqu01
    }
154 2486 sjacqu01
155 2486 sjacqu01
    void load_override(boost::serialization::item_version_type & t){
156 2486 sjacqu01
        library_version_type lvt = this->get_library_version();
157 2486 sjacqu01
//        if(boost::archive::library_version_type(7) < lvt){
158 2486 sjacqu01
        if(boost::archive::library_version_type(6) < lvt){
159 2486 sjacqu01
            this->detail_common_iarchive::load_override(t);
160 2486 sjacqu01
        }
161 2486 sjacqu01
        else
162 2486 sjacqu01
        if(boost::archive::library_version_type(6) < lvt){
163 2486 sjacqu01
            uint_least16_t x=0;
164 2486 sjacqu01
            * this->This() >> x;
165 2486 sjacqu01
            t = boost::serialization::item_version_type(x);
166 2486 sjacqu01
        }
167 2486 sjacqu01
        else{
168 2486 sjacqu01
            unsigned int x=0;
169 2486 sjacqu01
            * this->This() >> x;
170 2486 sjacqu01
            t = boost::serialization::item_version_type(x);
171 2486 sjacqu01
        }
172 2486 sjacqu01
    }
173 2486 sjacqu01
174 2486 sjacqu01
    void load_override(serialization::collection_size_type & t){
175 2486 sjacqu01
        if(boost::archive::library_version_type(5) < this->get_library_version()){
176 2486 sjacqu01
            this->detail_common_iarchive::load_override(t);
177 2486 sjacqu01
        }
178 2486 sjacqu01
        else{
179 2486 sjacqu01
            unsigned int x=0;
180 2486 sjacqu01
            * this->This() >> x;
181 2486 sjacqu01
            t = serialization::collection_size_type(x);
182 2486 sjacqu01
        }
183 2486 sjacqu01
    }
184 2486 sjacqu01
185 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
186 2486 sjacqu01
    load_override(class_name_type & t);
187 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
188 2486 sjacqu01
    init();
189 2486 sjacqu01
190 2486 sjacqu01
    basic_binary_iarchive(unsigned int flags) :
191 2486 sjacqu01
        detail::common_iarchive<Archive>(flags)
192 2486 sjacqu01
    {}
193 2486 sjacqu01
};
194 2486 sjacqu01
195 2486 sjacqu01
} // namespace archive
196 2486 sjacqu01
} // namespace boost
197 2486 sjacqu01
198 2486 sjacqu01
#ifdef BOOST_MSVC
199 2486 sjacqu01
#pragma warning(pop)
200 2486 sjacqu01
#endif
201 2486 sjacqu01
202 2486 sjacqu01
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
203 2486 sjacqu01
204 2486 sjacqu01
#endif // BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP