basic_iserializer.hpp 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP
  2. #define BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_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_iserializer.hpp: extension 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 <cstdlib> // NULL
  15. #include <boost/config.hpp>
  16. #include <boost/archive/basic_archive.hpp>
  17. #include <boost/archive/detail/decl.hpp>
  18. #include <boost/archive/detail/basic_serializer.hpp>
  19. #include <boost/archive/detail/auto_link_archive.hpp>
  20. #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
  21. #ifdef BOOST_MSVC
  22. # pragma warning(push)
  23. # pragma warning(disable : 4511 4512)
  24. #endif
  25. namespace boost {
  26. namespace serialization {
  27. class extended_type_info;
  28. } // namespace serialization
  29. // forward declarations
  30. namespace archive {
  31. namespace detail {
  32. class basic_iarchive;
  33. class basic_pointer_iserializer;
  34. class BOOST_SYMBOL_VISIBLE basic_iserializer :
  35. public basic_serializer
  36. {
  37. private:
  38. basic_pointer_iserializer *m_bpis;
  39. protected:
  40. explicit BOOST_ARCHIVE_DECL basic_iserializer(
  41. const boost::serialization::extended_type_info & type
  42. );
  43. virtual BOOST_ARCHIVE_DECL ~basic_iserializer();
  44. public:
  45. bool serialized_as_pointer() const {
  46. return m_bpis != NULL;
  47. }
  48. void set_bpis(basic_pointer_iserializer *bpis){
  49. m_bpis = bpis;
  50. }
  51. const basic_pointer_iserializer * get_bpis_ptr() const {
  52. return m_bpis;
  53. }
  54. virtual void load_object_data(
  55. basic_iarchive & ar,
  56. void *x,
  57. const unsigned int file_version
  58. ) const = 0;
  59. // returns true if class_info should be saved
  60. virtual bool class_info() const = 0 ;
  61. // returns true if objects should be tracked
  62. virtual bool tracking(const unsigned int) const = 0 ;
  63. // returns class version
  64. virtual version_type version() const = 0 ;
  65. // returns true if this class is polymorphic
  66. virtual bool is_polymorphic() const = 0;
  67. virtual void destroy(/*const*/ void *address) const = 0 ;
  68. };
  69. } // namespace detail
  70. } // namespace archive
  71. } // namespace boost
  72. #ifdef BOOST_MSVC
  73. #pragma warning(pop)
  74. #endif
  75. #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
  76. #endif // BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP