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