]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #ifndef BOOST_SERIALIZATION_ITEM_VERSION_TYPE_HPP |
2 | #define BOOST_SERIALIZATION_ITEM_VERSION_TYPE_HPP | |
3 | ||
4 | // (C) Copyright 2010 Robert Ramey | |
5 | // Use, modification and distribution is subject to the Boost Software | |
6 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
7 | // http://www.boost.org/LICENSE_1_0.txt) | |
8 | ||
9 | #include <boost/cstdint.hpp> // uint_least8_t | |
10 | #include <boost/integer_traits.hpp> | |
11 | #include <boost/serialization/level.hpp> | |
12 | #include <boost/serialization/is_bitwise_serializable.hpp> | |
13 | ||
14 | // fixes broken example build on x86_64-linux-gnu-gcc-4.6.0 | |
15 | #include <boost/assert.hpp> | |
16 | ||
17 | namespace boost { | |
18 | namespace serialization { | |
19 | ||
20 | #if defined(_MSC_VER) | |
21 | #pragma warning( push ) | |
22 | #pragma warning( disable : 4244 4267 ) | |
23 | #endif | |
24 | ||
25 | class item_version_type { | |
26 | private: | |
27 | typedef unsigned int base_type; | |
28 | base_type t; | |
29 | public: | |
30 | // should be private - but MPI fails if it's not!!! | |
31 | item_version_type(): t(0) {}; | |
32 | explicit item_version_type(const unsigned int t_) : t(t_){ | |
33 | BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max); | |
34 | } | |
35 | item_version_type(const item_version_type & t_) : | |
36 | t(t_.t) | |
37 | {} | |
38 | item_version_type & operator=(item_version_type rhs){ | |
39 | t = rhs.t; | |
40 | return *this; | |
41 | } | |
42 | // used for text output | |
43 | operator base_type () const { | |
44 | return t; | |
45 | } | |
46 | // used for text input | |
47 | operator base_type & () { | |
48 | return t; | |
49 | } | |
50 | bool operator==(const item_version_type & rhs) const { | |
51 | return t == rhs.t; | |
52 | } | |
53 | bool operator<(const item_version_type & rhs) const { | |
54 | return t < rhs.t; | |
55 | } | |
56 | }; | |
57 | ||
58 | #if defined(_MSC_VER) | |
59 | #pragma warning( pop ) | |
60 | #endif | |
61 | ||
62 | } } // end namespace boost::serialization | |
63 | ||
64 | BOOST_IS_BITWISE_SERIALIZABLE(item_version_type) | |
65 | ||
66 | BOOST_CLASS_IMPLEMENTATION(item_version_type, primitive_type) | |
67 | ||
68 | #endif //BOOST_SERIALIZATION_ITEM_VERSION_TYPE_HPP |