1 | #ifndef BOOST_SERIALIZATION_TEST_B_HPP |
---|---|
2 | #define BOOST_SERIALIZATION_TEST_B_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 | // B.hpp |
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 <cstdlib> // for rand() |
20 | #include <cmath> |
21 | #include <boost/config.hpp> |
22 | |
23 | #if defined(BOOST_NO_STDC_NAMESPACE) |
24 | namespace std{ |
25 | using ::rand; |
26 | } |
27 | #endif |
28 | |
29 | #include <boost/serialization/version.hpp> |
30 | #include <boost/serialization/split_member.hpp> |
31 | #include <boost/serialization/base_object.hpp> |
32 | |
33 | #include "A.hpp" |
34 | |
35 | /////////////////////////////////////////////////////// |
36 | // Derived class test |
37 | class B : public A |
38 | { |
39 | private: |
40 | friend class boost::serialization::access; |
41 | template<class Archive> |
42 | void save(Archive &ar, const unsigned int /* file_version */) const |
43 | { |
44 | // write any base class info to the archive |
45 | ar << BOOST_SERIALIZATION_BASE_OBJECT_NVP(A); |
46 | } |
47 | |
48 | template<class Archive> |
49 | void load(Archive & ar, const unsigned int file_version) |
50 | { |
51 | // read any base class info to the archive |
52 | ar >> BOOST_SERIALIZATION_BASE_OBJECT_NVP(A); |
53 | } |
54 | |
55 | BOOST_SERIALIZATION_SPLIT_MEMBER() |
56 | signed char s; |
57 | unsigned char t; |
58 | signed int u; |
59 | unsigned int v; |
60 | float w; |
61 | double x; |
62 | public: |
63 | B(); |
64 | virtual ~B(){}; |
65 | bool operator==(const B &rhs) const; |
66 | }; |
67 | |
68 | B::B() |
69 | { |
70 | } |
71 | |
72 | BOOST_CLASS_VERSION(B, 2) |
73 | |
74 | inline bool B::operator==(const B &rhs) const |
75 | { |
76 | return A::operator==(rhs); |
77 | } |
78 | |
79 | #endif // BOOST_SERIALIZATION_TEST_B_HPP |
80 |