polymorphic_base.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef POLYMORPHIC_BASE_HPP
  2. #define POLYMORPHIC_BASE_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_base.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/assume_abstract.hpp>
  17. #include <boost/serialization/export.hpp>
  18. #include <boost/serialization/type_info_implementation.hpp>
  19. #include <boost/serialization/extended_type_info_no_rtti.hpp>
  20. #if defined(POLYMORPHIC_BASE_IMPORT)
  21. #define POLYMORPHIC_BASE_DLL_DECL BOOST_SYMBOL_IMPORT
  22. #pragma message ("polymorphic_base imported")
  23. #elif defined(POLYMORPHIC_BASE_EXPORT)
  24. #define POLYMORPHIC_BASE_DLL_DECL BOOST_SYMBOL_EXPORT
  25. #pragma message ("polymorphic_base exported")
  26. #endif
  27. #ifndef POLYMORPHIC_BASE_DLL_DECL
  28. #define POLYMORPHIC_BASE_DLL_DECL
  29. #endif
  30. class BOOST_SYMBOL_VISIBLE polymorphic_base
  31. {
  32. friend class boost::serialization::access;
  33. template<class Archive>
  34. POLYMORPHIC_BASE_DLL_DECL void serialize(
  35. Archive & /* ar */,
  36. const unsigned int /* file_version */
  37. );
  38. public:
  39. // note that since this class uses the "no_rtti"
  40. // extended_type_info implementation, it MUST
  41. // implement this function
  42. virtual const char * get_key() const = 0;
  43. POLYMORPHIC_BASE_DLL_DECL polymorphic_base();
  44. POLYMORPHIC_BASE_DLL_DECL virtual ~polymorphic_base();
  45. };
  46. BOOST_SERIALIZATION_ASSUME_ABSTRACT(polymorphic_base)
  47. // the no_rtti system requires this !!!
  48. BOOST_CLASS_EXPORT_KEY(polymorphic_base)
  49. BOOST_CLASS_TYPE_INFO(
  50. polymorphic_base,
  51. extended_type_info_no_rtti<polymorphic_base>
  52. )
  53. #endif // POLYMORPHIC_BASE_HPP