1 | #ifndef BOOST_ARCHIVE_BASIC_SERIALIZER_HPP |
2 | #define BOOST_ARCHIVE_BASIC_SERIALIZER_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 | // basic_serializer.hpp: extension of type_info required for serialization. |
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 | |
19 | #include <boost/assert.hpp> |
20 | #include <cstddef> // NULL |
21 | |
22 | #include <boost/noncopyable.hpp> |
23 | #include <boost/config.hpp> |
24 | #include <boost/serialization/extended_type_info.hpp> |
25 | |
26 | #ifdef BOOST_MSVC |
27 | # pragma warning(push) |
28 | # pragma warning(disable : 4511 4512) |
29 | #endif |
30 | |
31 | namespace boost { |
32 | namespace archive { |
33 | namespace detail { |
34 | |
35 | class basic_serializer : |
36 | private boost::noncopyable |
37 | { |
38 | const boost::serialization::extended_type_info * m_eti; |
39 | protected: |
40 | explicit basic_serializer( |
41 | const boost::serialization::extended_type_info & eti |
42 | ) : |
43 | m_eti(& eti) |
44 | {} |
45 | public: |
46 | inline bool |
47 | operator<(const basic_serializer & rhs) const { |
48 | // can't compare address since there can be multiple eti records |
49 | // for the same type in different execution modules (that is, DLLS) |
50 | // leave this here as a reminder not to do this! |
51 | // return & lhs.get_eti() < & rhs.get_eti(); |
52 | return get_eti() < rhs.get_eti(); |
53 | } |
54 | const char * get_debug_info() const { |
55 | return m_eti->get_debug_info(); |
56 | } |
57 | const boost::serialization::extended_type_info & get_eti() const { |
58 | return * m_eti; |
59 | } |
60 | }; |
61 | |
62 | class basic_serializer_arg : public basic_serializer { |
63 | public: |
64 | basic_serializer_arg(const serialization::extended_type_info & eti) : |
65 | basic_serializer(eti) |
66 | {} |
67 | }; |
68 | |
69 | } // namespace detail |
70 | } // namespace archive |
71 | } // namespace boost |
72 | |
73 | #ifdef BOOST_MSVC |
74 | #pragma warning(pop) |
75 | #endif |
76 | |
77 | #endif // BOOST_ARCHIVE_BASIC_SERIALIZER_HPP |
78 | |