[12] | 1 | #ifndef BOOST_SERIALIZATION_TEST_A_HPP |
---|
| 2 | #define BOOST_SERIALIZATION_TEST_A_HPP |
---|
| 3 | |
---|
| 4 | // MS compatible compilers support #pragma once |
---|
| 5 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) |
---|
| 6 | # pragma once |
---|
| 7 | #endif |
---|
| 8 | |
---|
| 9 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
---|
| 10 | // C.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 <boost/config.hpp> |
---|
| 20 | #include <boost/serialization/traits.hpp> |
---|
| 21 | #include <boost/serialization/split.hpp> |
---|
| 22 | |
---|
| 23 | #include "B.hpp" |
---|
| 24 | |
---|
| 25 | /////////////////////////////////////////////////////// |
---|
| 26 | // Contained class |
---|
| 27 | class C |
---|
| 28 | { |
---|
| 29 | private: |
---|
| 30 | friend class boost::serialization::access; |
---|
| 31 | template<class Archive> |
---|
| 32 | void save(Archive &ar, boost::archive::version_type file_version) const; |
---|
| 33 | template<class Archive> |
---|
| 34 | void load(Archive & ar, boost::archive::version_type file_version); |
---|
| 35 | BOOST_SERIALIZATION_MEMBER_SPLIT() |
---|
| 36 | B b; |
---|
| 37 | public: |
---|
| 38 | bool operator==(const C &rhs) const; |
---|
| 39 | }; |
---|
| 40 | |
---|
| 41 | BOOST_CLASS_VERSION(C, 1) |
---|
| 42 | |
---|
| 43 | inline bool C::operator==(const C &rhs) const |
---|
| 44 | { |
---|
| 45 | return b == rhs.b; |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | template<class Archive> |
---|
| 49 | inline void save(Archive &ar, boost::archive::version_type file_version) const |
---|
| 50 | { |
---|
| 51 | ar << b; |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | template<class Archive> |
---|
| 55 | inline void load(Archive & ar, boost::archive::version_type file_version){ |
---|
| 56 | { |
---|
| 57 | switch(file_version){ |
---|
| 58 | case 1: |
---|
| 59 | ar >> b; |
---|
| 60 | break; |
---|
| 61 | case 2: |
---|
| 62 | default: |
---|
| 63 | assert(false); |
---|
| 64 | break; |
---|
| 65 | } |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | #endif // BOOST_SERIALIZATION_TEST_C_HPP |
---|