Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/serialization/test/test_polymorphic_A.cpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.7 KB
Line 
1/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2// test_polymorphic_A.cpp
3
4// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
5// Use, modification and distribution is subject to the Boost Software
6// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8
9#include "test_polymorphic_A.hpp"
10#include <boost/serialization/nvp.hpp>
11#include "A.hpp"
12
13data::data() :
14    a(new A)
15{}
16data::~data(){
17    delete a;
18}
19
20bool data::operator==(const data & rhs) const {
21    return * (a) == *(rhs.a);
22}
23
24#if 0 // this method fails with msvc 6.0 and borland
25// now we can define the serialization for class A
26template<class Archive>
27void data::serialize(Archive & ar, const unsigned int /* file_version */){
28    ar & BOOST_SERIALIZATION_NVP(a);
29}
30
31// without the explicit instantiations below, the program will
32// fail to link for lack of instantiantiation of the above function
33// note: the following failed to fix link errors for vc 7.0 !
34#include <boost/archive/polymorphic_oarchive.hpp>
35
36template void data::serialize<boost::archive::polymorphic_oarchive>(
37    boost::archive::polymorphic_oarchive & ar,
38    const unsigned int file_version
39);
40
41#include <boost/archive/polymorphic_iarchive.hpp>
42
43template void data::serialize<boost::archive::polymorphic_iarchive>(
44    boost::archive::polymorphic_iarchive & ar,
45    const unsigned int file_version
46);
47#endif
48
49// so use this
50void data::serialize(boost::archive::polymorphic_oarchive & ar, const unsigned int /* file_version */){
51    ar & BOOST_SERIALIZATION_NVP(a);
52}
53
54void data::serialize(boost::archive::polymorphic_iarchive & ar, const unsigned int /* file_version */){
55    ar & BOOST_SERIALIZATION_NVP(a);
56}
Note: See TracBrowser for help on using the repository browser.