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) && (_MSC_VER >= 1020)
6 # pragma once
7 #endif
8 
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // basic_serializer.hpp: extenstion 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:
basic_serializer(const boost::serialization::extended_type_info & eti)40     explicit basic_serializer(
41         const boost::serialization::extended_type_info & eti
42     ) :
43         m_eti(& eti)
44     {
45         BOOST_ASSERT(NULL != & eti);
46     }
47 public:
48     inline bool
operator <(const basic_serializer & rhs) const49     operator<(const basic_serializer & rhs) const {
50         // can't compare address since there can be multiple eti records
51         // for the same type in different execution modules (that is, DLLS)
52         // leave this here as a reminder not to do this!
53         // return & lhs.get_eti() < & rhs.get_eti();
54         return get_eti() < rhs.get_eti();
55     }
get_debug_info() const56     const char * get_debug_info() const {
57         return m_eti->get_debug_info();
58     }
get_eti() const59     const boost::serialization::extended_type_info & get_eti() const {
60         return * m_eti;
61     }
62 };
63 
64 class basic_serializer_arg : public basic_serializer {
65 public:
basic_serializer_arg(const serialization::extended_type_info & eti)66     basic_serializer_arg(const serialization::extended_type_info & eti) :
67         basic_serializer(eti)
68     {}
69 };
70 
71 } // namespace detail
72 } // namespace archive
73 } // namespace boost
74 
75 #ifdef BOOST_MSVC
76 #pragma warning(pop)
77 #endif
78 
79 #endif // BOOST_ARCHIVE_BASIC_SERIALIZER_HPP
80