basic_serializer.hpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef BOOST_ARCHIVE_BASIC_SERIALIZER_HPP
  2. #define BOOST_ARCHIVE_BASIC_SERIALIZER_HPP
  3. // MS compatible compilers support #pragma once
  4. #if defined(_MSC_VER)
  5. # pragma once
  6. #endif
  7. /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
  8. // basic_serializer.hpp: extenstion of type_info required for serialization.
  9. // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
  10. // Use, modification and distribution is subject to the Boost Software
  11. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  12. // http://www.boost.org/LICENSE_1_0.txt)
  13. // See http://www.boost.org for updates, documentation, and revision history.
  14. #include <boost/assert.hpp>
  15. #include <cstddef> // NULL
  16. #include <boost/noncopyable.hpp>
  17. #include <boost/config.hpp>
  18. #include <boost/serialization/extended_type_info.hpp>
  19. #ifdef BOOST_MSVC
  20. # pragma warning(push)
  21. # pragma warning(disable : 4511 4512)
  22. #endif
  23. namespace boost {
  24. namespace archive {
  25. namespace detail {
  26. class basic_serializer :
  27. private boost::noncopyable
  28. {
  29. const boost::serialization::extended_type_info * m_eti;
  30. protected:
  31. explicit basic_serializer(
  32. const boost::serialization::extended_type_info & eti
  33. ) :
  34. m_eti(& eti)
  35. {}
  36. public:
  37. inline bool
  38. operator<(const basic_serializer & rhs) const {
  39. // can't compare address since there can be multiple eti records
  40. // for the same type in different execution modules (that is, DLLS)
  41. // leave this here as a reminder not to do this!
  42. // return & lhs.get_eti() < & rhs.get_eti();
  43. return get_eti() < rhs.get_eti();
  44. }
  45. const char * get_debug_info() const {
  46. return m_eti->get_debug_info();
  47. }
  48. const boost::serialization::extended_type_info & get_eti() const {
  49. return * m_eti;
  50. }
  51. };
  52. class basic_serializer_arg : public basic_serializer {
  53. public:
  54. basic_serializer_arg(const serialization::extended_type_info & eti) :
  55. basic_serializer(eti)
  56. {}
  57. };
  58. } // namespace detail
  59. } // namespace archive
  60. } // namespace boost
  61. #ifdef BOOST_MSVC
  62. #pragma warning(pop)
  63. #endif
  64. #endif // BOOST_ARCHIVE_BASIC_SERIALIZER_HPP