| 1 |
#ifndef POLYMORPHIC_DERIVED2_HPP |
| 2 |
#define POLYMORPHIC_DERIVED2_HPP |
| 3 |
|
| 4 |
#include <boost/config.hpp> |
| 5 |
|
| 6 |
#include <boost/serialization/access.hpp> |
| 7 |
#include <boost/serialization/nvp.hpp> |
| 8 |
#include <boost/serialization/base_object.hpp> |
| 9 |
#include <boost/serialization/type_info_implementation.hpp> |
| 10 |
#include <boost/serialization/extended_type_info_typeid.hpp> |
| 11 |
|
| 12 |
#include "polymorphic_base.hpp" |
| 13 |
|
| 14 |
class polymorphic_derived2 : |
| 15 |
public polymorphic_base |
| 16 |
{ |
| 17 |
friend class boost::serialization::access; |
| 18 |
template<class Archive> |
| 19 |
void serialize( |
| 20 |
Archive &ar, |
| 21 |
const unsigned int /* file_version */ |
| 22 |
); |
| 23 |
virtual const char * get_key() const { |
| 24 |
return "polymorphic_derived2"; |
| 25 |
} |
| 26 |
}; |
| 27 |
|
| 28 |
// we use this because we want to assign a key to this type |
| 29 |
// but we don't want to explicitly instantiate code every time |
| 30 |
// we do so!!! If we don't do this, we end up with the same |
| 31 |
// code in BOTH the DLL which implements polymorphic_derived2 |
| 32 |
// as well as the main program. |
| 33 |
BOOST_CLASS_EXPORT_KEY(polymorphic_derived2) |
| 34 |
|
| 35 |
// note the mixing of type_info systems is supported. |
| 36 |
BOOST_CLASS_TYPE_INFO( |
| 37 |
polymorphic_derived2, |
| 38 |
boost::serialization::extended_type_info_typeid<polymorphic_derived2> |
| 39 |
) |
| 40 |
|
| 41 |
#endif // POLYMORPHIC_DERIVED2_HPP |