polymorphic_derived2.hpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef BOOST_SERIALIZATION_TEST_POLYMORPHIC_DERIVED2_HPP
  2. #define BOOST_SERIALIZATION_TEST_POLYMORPHIC_DERIVED2_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. // polymorphic_derived2.hpp simple class test
  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/config.hpp>
  15. #include <boost/serialization/access.hpp>
  16. #include <boost/serialization/nvp.hpp>
  17. #include <boost/serialization/base_object.hpp>
  18. #include <boost/serialization/type_info_implementation.hpp>
  19. #include <boost/serialization/extended_type_info_typeid.hpp>
  20. #if defined(POLYMORPHIC_DERIVED2_IMPORT)
  21. #define POLYMORPHIC_DERIVED2_DLL_DECL BOOST_SYMBOL_IMPORT
  22. #pragma message ("polymorphic_derived2 imported")
  23. #elif defined(POLYMORPHIC_DERIVED2_EXPORT)
  24. #define POLYMORPHIC_DERIVED2_DLL_DECL BOOST_SYMBOL_EXPORT
  25. #pragma message ("polymorphic_derived2 exported")
  26. #endif
  27. #ifndef POLYMORPHIC_DERIVED2_DLL_DECL
  28. #define POLYMORPHIC_DERIVED2_DLL_DECL
  29. #endif
  30. #define POLYMORPHIC_BASE_IMPORT
  31. #include "polymorphic_base.hpp"
  32. class BOOST_SYMBOL_VISIBLE polymorphic_derived2 :
  33. public polymorphic_base
  34. {
  35. friend class boost::serialization::access;
  36. template<class Archive>
  37. POLYMORPHIC_DERIVED2_DLL_DECL void serialize(
  38. Archive &ar,
  39. const unsigned int /* file_version */
  40. );
  41. POLYMORPHIC_DERIVED2_DLL_DECL const char * get_key() const;
  42. public:
  43. POLYMORPHIC_DERIVED2_DLL_DECL polymorphic_derived2();
  44. POLYMORPHIC_DERIVED2_DLL_DECL ~polymorphic_derived2();
  45. };
  46. // we use this because we want to assign a key to this type
  47. // but we don't want to explicitly instantiate code every time
  48. // we do so!!!. If we don't do this, we end up with the same
  49. // code in BOTH the DLL which implements polymorphic_derived2
  50. // as well as the main program.
  51. BOOST_CLASS_EXPORT_KEY(polymorphic_derived2)
  52. // note the mixing of type_info systems is supported.
  53. BOOST_CLASS_TYPE_INFO(
  54. polymorphic_derived2,
  55. boost::serialization::extended_type_info_typeid<polymorphic_derived2>
  56. )
  57. #endif // BOOST_SERIALIZATION_TEST_POLYMORPHIC_DERIVED2_HPP