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