Statistics
| Revision:

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

History | View | Annotate | Download (9 kB)

1 2486 sjacqu01
#ifndef BOOST_ARCHIVE_BASIC_ARCHIVE_HPP
2 2486 sjacqu01
#define BOOST_ARCHIVE_BASIC_ARCHIVE_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_archive.hpp:
11 2486 sjacqu01
12 2486 sjacqu01
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13 2486 sjacqu01
// Use, modification and distribution is subject to the Boost Software
14 2486 sjacqu01
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 2486 sjacqu01
// http://www.boost.org/LICENSE_1_0.txt)
16 2486 sjacqu01
17 2486 sjacqu01
//  See http://www.boost.org for updates, documentation, and revision history.
18 2486 sjacqu01
#include <cstring> // count
19 2486 sjacqu01
#include <boost/assert.hpp>
20 2486 sjacqu01
#include <boost/config.hpp>
21 2486 sjacqu01
#include <boost/cstdint.hpp> // size_t
22 2486 sjacqu01
#include <boost/noncopyable.hpp>
23 2486 sjacqu01
#include <boost/integer_traits.hpp>
24 2486 sjacqu01
25 2486 sjacqu01
#include <boost/archive/detail/auto_link_archive.hpp>
26 2486 sjacqu01
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
27 2486 sjacqu01
28 2486 sjacqu01
namespace boost {
29 2486 sjacqu01
namespace archive {
30 2486 sjacqu01
31 2486 sjacqu01
#if defined(_MSC_VER)
32 2486 sjacqu01
#pragma warning( push )
33 2486 sjacqu01
#pragma warning( disable : 4244 4267 )
34 2486 sjacqu01
#endif
35 2486 sjacqu01
36 2486 sjacqu01
/* NOTE : Warning  : Warning : Warning : Warning : Warning
37 2486 sjacqu01
 * Don't ever changes this.  If you do, they previously created
38 2486 sjacqu01
 * binary archives won't be readable !!!
39 2486 sjacqu01
 */
40 2486 sjacqu01
class library_version_type {
41 2486 sjacqu01
private:
42 2486 sjacqu01
    typedef uint_least16_t base_type;
43 2486 sjacqu01
    base_type t;
44 2486 sjacqu01
public:
45 2486 sjacqu01
    library_version_type(): t(0) {};
46 2486 sjacqu01
    explicit library_version_type(const unsigned int & t_) : t(t_){
47 2486 sjacqu01
        BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
48 2486 sjacqu01
    }
49 2486 sjacqu01
    library_version_type(const library_version_type & t_) :
50 2486 sjacqu01
        t(t_.t)
51 2486 sjacqu01
    {}
52 2486 sjacqu01
    library_version_type & operator=(const library_version_type & rhs){
53 2486 sjacqu01
        t = rhs.t;
54 2486 sjacqu01
        return *this;
55 2486 sjacqu01
    }
56 2486 sjacqu01
    // used for text output
57 2486 sjacqu01
    operator base_type () const {
58 2486 sjacqu01
        return t;
59 2486 sjacqu01
    }
60 2486 sjacqu01
    // used for text input
61 2486 sjacqu01
    operator base_type & (){
62 2486 sjacqu01
        return t;
63 2486 sjacqu01
    }
64 2486 sjacqu01
    bool operator==(const library_version_type & rhs) const {
65 2486 sjacqu01
        return t == rhs.t;
66 2486 sjacqu01
    }
67 2486 sjacqu01
    bool operator<(const library_version_type & rhs) const {
68 2486 sjacqu01
        return t < rhs.t;
69 2486 sjacqu01
    }
70 2486 sjacqu01
};
71 2486 sjacqu01
72 2486 sjacqu01
BOOST_ARCHIVE_DECL library_version_type
73 2486 sjacqu01
BOOST_ARCHIVE_VERSION();
74 2486 sjacqu01
75 2486 sjacqu01
class version_type {
76 2486 sjacqu01
private:
77 2486 sjacqu01
    typedef uint_least32_t base_type;
78 2486 sjacqu01
    base_type t;
79 2486 sjacqu01
public:
80 2486 sjacqu01
    // should be private - but MPI fails if it's not!!!
81 2486 sjacqu01
    version_type(): t(0) {};
82 2486 sjacqu01
    explicit version_type(const unsigned int & t_) : t(t_){
83 2486 sjacqu01
        BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
84 2486 sjacqu01
    }
85 2486 sjacqu01
    version_type(const version_type & t_) :
86 2486 sjacqu01
        t(t_.t)
87 2486 sjacqu01
    {}
88 2486 sjacqu01
    version_type & operator=(const version_type & rhs){
89 2486 sjacqu01
        t = rhs.t;
90 2486 sjacqu01
        return *this;
91 2486 sjacqu01
    }
92 2486 sjacqu01
    // used for text output
93 2486 sjacqu01
    operator base_type () const {
94 2486 sjacqu01
        return t;
95 2486 sjacqu01
    }
96 2486 sjacqu01
    // used for text intput
97 2486 sjacqu01
    operator base_type  & (){
98 2486 sjacqu01
        return t;
99 2486 sjacqu01
    }
100 2486 sjacqu01
    bool operator==(const version_type & rhs) const {
101 2486 sjacqu01
        return t == rhs.t;
102 2486 sjacqu01
    }
103 2486 sjacqu01
    bool operator<(const version_type & rhs) const {
104 2486 sjacqu01
        return t < rhs.t;
105 2486 sjacqu01
    }
106 2486 sjacqu01
};
107 2486 sjacqu01
108 2486 sjacqu01
class class_id_type {
109 2486 sjacqu01
private:
110 2486 sjacqu01
    typedef int_least16_t base_type;
111 2486 sjacqu01
    base_type t;
112 2486 sjacqu01
public:
113 2486 sjacqu01
    // should be private - but then can't use BOOST_STRONG_TYPE below
114 2486 sjacqu01
    class_id_type() : t(0) {};
115 2486 sjacqu01
    explicit class_id_type(const int t_) : t(t_){
116 2486 sjacqu01
        BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
117 2486 sjacqu01
    }
118 2486 sjacqu01
    explicit class_id_type(const std::size_t t_) : t(t_){
119 2486 sjacqu01
 //       BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
120 2486 sjacqu01
    }
121 2486 sjacqu01
    class_id_type(const class_id_type & t_) :
122 2486 sjacqu01
        t(t_.t)
123 2486 sjacqu01
    {}
124 2486 sjacqu01
    class_id_type & operator=(const class_id_type & rhs){
125 2486 sjacqu01
        t = rhs.t;
126 2486 sjacqu01
        return *this;
127 2486 sjacqu01
    }
128 2486 sjacqu01
129 2486 sjacqu01
    // used for text output
130 2486 sjacqu01
    operator int () const {
131 2486 sjacqu01
        return t;
132 2486 sjacqu01
    }
133 2486 sjacqu01
    // used for text input
134 2486 sjacqu01
    operator int_least16_t &() {
135 2486 sjacqu01
        return t;
136 2486 sjacqu01
    }
137 2486 sjacqu01
    bool operator==(const class_id_type & rhs) const {
138 2486 sjacqu01
        return t == rhs.t;
139 2486 sjacqu01
    }
140 2486 sjacqu01
    bool operator<(const class_id_type & rhs) const {
141 2486 sjacqu01
        return t < rhs.t;
142 2486 sjacqu01
    }
143 2486 sjacqu01
};
144 2486 sjacqu01
145 2486 sjacqu01
#define NULL_POINTER_TAG boost::archive::class_id_type(-1)
146 2486 sjacqu01
147 2486 sjacqu01
class object_id_type {
148 2486 sjacqu01
private:
149 2486 sjacqu01
    typedef uint_least32_t base_type;
150 2486 sjacqu01
    base_type t;
151 2486 sjacqu01
public:
152 2486 sjacqu01
    object_id_type(): t(0) {};
153 2486 sjacqu01
    // note: presumes that size_t >= unsigned int.
154 2486 sjacqu01
    explicit object_id_type(const std::size_t & t_) : t(t_){
155 2486 sjacqu01
        BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
156 2486 sjacqu01
    }
157 2486 sjacqu01
    object_id_type(const object_id_type & t_) :
158 2486 sjacqu01
        t(t_.t)
159 2486 sjacqu01
    {}
160 2486 sjacqu01
    object_id_type & operator=(const object_id_type & rhs){
161 2486 sjacqu01
        t = rhs.t;
162 2486 sjacqu01
        return *this;
163 2486 sjacqu01
    }
164 2486 sjacqu01
    // used for text output
165 2486 sjacqu01
    operator uint_least32_t () const {
166 2486 sjacqu01
        return t;
167 2486 sjacqu01
    }
168 2486 sjacqu01
    // used for text input
169 2486 sjacqu01
    operator uint_least32_t & () {
170 2486 sjacqu01
        return t;
171 2486 sjacqu01
    }
172 2486 sjacqu01
    bool operator==(const object_id_type & rhs) const {
173 2486 sjacqu01
        return t == rhs.t;
174 2486 sjacqu01
    }
175 2486 sjacqu01
    bool operator<(const object_id_type & rhs) const {
176 2486 sjacqu01
        return t < rhs.t;
177 2486 sjacqu01
    }
178 2486 sjacqu01
};
179 2486 sjacqu01
180 2486 sjacqu01
#if defined(_MSC_VER)
181 2486 sjacqu01
#pragma warning( pop )
182 2486 sjacqu01
#endif
183 2486 sjacqu01
184 2486 sjacqu01
struct tracking_type {
185 2486 sjacqu01
    bool t;
186 2486 sjacqu01
    explicit tracking_type(const bool t_ = false)
187 2486 sjacqu01
        : t(t_)
188 2486 sjacqu01
    {};
189 2486 sjacqu01
    tracking_type(const tracking_type & t_)
190 2486 sjacqu01
        : t(t_.t)
191 2486 sjacqu01
    {}
192 2486 sjacqu01
    operator bool () const {
193 2486 sjacqu01
        return t;
194 2486 sjacqu01
    };
195 2486 sjacqu01
    operator bool & () {
196 2486 sjacqu01
        return t;
197 2486 sjacqu01
    };
198 2486 sjacqu01
    tracking_type & operator=(const bool t_){
199 2486 sjacqu01
        t = t_;
200 2486 sjacqu01
        return *this;
201 2486 sjacqu01
    }
202 2486 sjacqu01
    bool operator==(const tracking_type & rhs) const {
203 2486 sjacqu01
        return t == rhs.t;
204 2486 sjacqu01
    }
205 2486 sjacqu01
    bool operator==(const bool & rhs) const {
206 2486 sjacqu01
        return t == rhs;
207 2486 sjacqu01
    }
208 2486 sjacqu01
    tracking_type & operator=(const tracking_type & rhs){
209 2486 sjacqu01
        t = rhs.t;
210 2486 sjacqu01
        return *this;
211 2486 sjacqu01
    }
212 2486 sjacqu01
};
213 2486 sjacqu01
214 2486 sjacqu01
struct class_name_type :
215 2486 sjacqu01
    private boost::noncopyable
216 2486 sjacqu01
{
217 2486 sjacqu01
    char *t;
218 2486 sjacqu01
    operator const char * & () const {
219 2486 sjacqu01
        return const_cast<const char * &>(t);
220 2486 sjacqu01
    }
221 2486 sjacqu01
    operator char * () {
222 2486 sjacqu01
        return t;
223 2486 sjacqu01
    }
224 2486 sjacqu01
    std::size_t size() const {
225 2486 sjacqu01
        return std::strlen(t);
226 2486 sjacqu01
    }
227 2486 sjacqu01
    explicit class_name_type(const char *key_)
228 2486 sjacqu01
    : t(const_cast<char *>(key_)){}
229 2486 sjacqu01
    explicit class_name_type(char *key_)
230 2486 sjacqu01
    : t(key_){}
231 2486 sjacqu01
    class_name_type & operator=(const class_name_type & rhs){
232 2486 sjacqu01
        t = rhs.t;
233 2486 sjacqu01
        return *this;
234 2486 sjacqu01
    }
235 2486 sjacqu01
};
236 2486 sjacqu01
237 2486 sjacqu01
enum archive_flags {
238 2486 sjacqu01
    no_header = 1,  // suppress archive header info
239 2486 sjacqu01
    no_codecvt = 2,  // suppress alteration of codecvt facet
240 2486 sjacqu01
    no_xml_tag_checking = 4,   // suppress checking of xml tags
241 2486 sjacqu01
    no_tracking = 8,           // suppress ALL tracking
242 2486 sjacqu01
    flags_last = 8
243 2486 sjacqu01
};
244 2486 sjacqu01
245 2486 sjacqu01
BOOST_ARCHIVE_DECL const char *
246 2486 sjacqu01
BOOST_ARCHIVE_SIGNATURE();
247 2486 sjacqu01
248 2486 sjacqu01
/* NOTE : Warning  : Warning : Warning : Warning : Warning
249 2486 sjacqu01
 * If any of these are changed to different sized types,
250 2486 sjacqu01
 * binary_iarchive won't be able to read older archives
251 2486 sjacqu01
 * unless you rev the library version and include conditional
252 2486 sjacqu01
 * code based on the library version.  There is nothing
253 2486 sjacqu01
 * inherently wrong in doing this - but you have to be super
254 2486 sjacqu01
 * careful because it's easy to get wrong and start breaking
255 2486 sjacqu01
 * old archives !!!
256 2486 sjacqu01
 */
257 2486 sjacqu01
258 2486 sjacqu01
#define BOOST_ARCHIVE_STRONG_TYPEDEF(T, D)         \
259 2486 sjacqu01
    class D : public T {                           \
260 2486 sjacqu01
    public:                                        \
261 2486 sjacqu01
        explicit D(const T tt) : T(tt){}           \
262 2486 sjacqu01
    };                                             \
263 2486 sjacqu01
/**/
264 2486 sjacqu01
265 2486 sjacqu01
BOOST_ARCHIVE_STRONG_TYPEDEF(class_id_type, class_id_reference_type)
266 2486 sjacqu01
BOOST_ARCHIVE_STRONG_TYPEDEF(class_id_type, class_id_optional_type)
267 2486 sjacqu01
BOOST_ARCHIVE_STRONG_TYPEDEF(object_id_type, object_reference_type)
268 2486 sjacqu01
269 2486 sjacqu01
}// namespace archive
270 2486 sjacqu01
}// namespace boost
271 2486 sjacqu01
272 2486 sjacqu01
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
273 2486 sjacqu01
274 2486 sjacqu01
#include <boost/serialization/level.hpp>
275 2486 sjacqu01
276 2486 sjacqu01
// set implementation level to primitive for all types
277 2486 sjacqu01
// used internally by the serialization library
278 2486 sjacqu01
279 2486 sjacqu01
BOOST_CLASS_IMPLEMENTATION(boost::archive::library_version_type, primitive_type)
280 2486 sjacqu01
BOOST_CLASS_IMPLEMENTATION(boost::archive::version_type, primitive_type)
281 2486 sjacqu01
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_type, primitive_type)
282 2486 sjacqu01
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_reference_type, primitive_type)
283 2486 sjacqu01
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_optional_type, primitive_type)
284 2486 sjacqu01
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_name_type, primitive_type)
285 2486 sjacqu01
BOOST_CLASS_IMPLEMENTATION(boost::archive::object_id_type, primitive_type)
286 2486 sjacqu01
BOOST_CLASS_IMPLEMENTATION(boost::archive::object_reference_type, primitive_type)
287 2486 sjacqu01
BOOST_CLASS_IMPLEMENTATION(boost::archive::tracking_type, primitive_type)
288 2486 sjacqu01
289 2486 sjacqu01
#include <boost/serialization/is_bitwise_serializable.hpp>
290 2486 sjacqu01
291 2486 sjacqu01
// set types used internally by the serialization library
292 2486 sjacqu01
// to be bitwise serializable
293 2486 sjacqu01
294 2486 sjacqu01
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::library_version_type)
295 2486 sjacqu01
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::version_type)
296 2486 sjacqu01
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_id_type)
297 2486 sjacqu01
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_id_reference_type)
298 2486 sjacqu01
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_id_optional_type)
299 2486 sjacqu01
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_name_type)
300 2486 sjacqu01
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::object_id_type)
301 2486 sjacqu01
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::object_reference_type)
302 2486 sjacqu01
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::tracking_type)
303 2486 sjacqu01
304 2486 sjacqu01
#endif //BOOST_ARCHIVE_BASIC_ARCHIVE_HPP