basic_oserializer.hpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #ifndef BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP
  2. #define BOOST_SERIALIZATION_BASIC_OSERIALIZER_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_oserializer.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 <cstddef> // NULL
  15. #include <boost/config.hpp>
  16. #include <boost/noncopyable.hpp>
  17. #include <boost/archive/basic_archive.hpp>
  18. #include <boost/archive/detail/auto_link_archive.hpp>
  19. #include <boost/archive/detail/basic_serializer.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_oarchive;
  33. class basic_pointer_oserializer;
  34. class BOOST_SYMBOL_VISIBLE basic_oserializer :
  35. public basic_serializer
  36. {
  37. private:
  38. basic_pointer_oserializer *m_bpos;
  39. protected:
  40. explicit BOOST_ARCHIVE_DECL basic_oserializer(
  41. const boost::serialization::extended_type_info & type_
  42. );
  43. virtual BOOST_ARCHIVE_DECL ~basic_oserializer();
  44. public:
  45. bool serialized_as_pointer() const {
  46. return m_bpos != NULL;
  47. }
  48. void set_bpos(basic_pointer_oserializer *bpos){
  49. m_bpos = bpos;
  50. }
  51. const basic_pointer_oserializer * get_bpos() const {
  52. return m_bpos;
  53. }
  54. virtual void save_object_data(
  55. basic_oarchive & ar, const void * x
  56. ) const = 0;
  57. // returns true if class_info should be saved
  58. virtual bool class_info() const = 0;
  59. // returns true if objects should be tracked
  60. virtual bool tracking(const unsigned int flags) const = 0;
  61. // returns class version
  62. virtual version_type version() const = 0;
  63. // returns true if this class is polymorphic
  64. virtual bool is_polymorphic() const = 0;
  65. };
  66. } // namespace detail
  67. } // namespace serialization
  68. } // namespace boost
  69. #ifdef BOOST_MSVC
  70. #pragma warning(pop)
  71. #endif
  72. #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
  73. #endif // BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP