Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / serialization / test / polymorphic_base.hpp
1 #ifndef POLYMORPHIC_BASE_HPP
2 #define POLYMORPHIC_BASE_HPP
3
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER)
6 # pragma once
7 #endif
8
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // polymorphic_base.hpp    simple class test
11
12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . 
13 // Use, modification and distribution is subject to the Boost Software
14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
16
17 //  See http://www.boost.org for updates, documentation, and revision history.
18
19 #include <boost/config.hpp>
20
21 #include <boost/serialization/access.hpp>
22 #include <boost/serialization/assume_abstract.hpp>
23 #include <boost/serialization/export.hpp>
24 #include <boost/serialization/type_info_implementation.hpp>
25 #include <boost/serialization/extended_type_info_no_rtti.hpp>
26
27 #if defined(POLYMORPHIC_BASE_IMPORT)
28     #define POLYMORPHIC_BASE_DLL_DECL BOOST_SYMBOL_IMPORT
29     #pragma message ("polymorphic_base imported")
30 #elif defined(POLYMORPHIC_BASE_EXPORT)
31     #define POLYMORPHIC_BASE_DLL_DECL BOOST_SYMBOL_EXPORT
32     #pragma message ("polymorphic_base exported")
33 #endif
34
35 #ifndef POLYMORPHIC_BASE_DLL_DECL
36     #define POLYMORPHIC_BASE_DLL_DECL
37 #endif
38
39 class BOOST_SYMBOL_VISIBLE polymorphic_base
40 {
41     friend class boost::serialization::access;
42     template<class Archive>
43     POLYMORPHIC_BASE_DLL_DECL void serialize(
44         Archive & /* ar */, 
45         const unsigned int /* file_version */
46     );
47 public:
48     // note that since this class uses the "no_rtti"
49     // extended_type_info implementation, it MUST
50     // implement this function
51     virtual const char * get_key() const = 0;
52     POLYMORPHIC_BASE_DLL_DECL polymorphic_base();
53     POLYMORPHIC_BASE_DLL_DECL virtual ~polymorphic_base();
54 };
55
56 BOOST_SERIALIZATION_ASSUME_ABSTRACT(polymorphic_base)
57
58 // the no_rtti system requires this !!!
59 BOOST_CLASS_EXPORT_KEY(polymorphic_base)
60
61 BOOST_CLASS_TYPE_INFO(
62     polymorphic_base,
63     extended_type_info_no_rtti<polymorphic_base>
64 )
65
66 #endif // POLYMORPHIC_BASE_HPP