]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // (C) Copyright 2005 Matthias Troyer |
2 | ||
3 | // Use, modification and distribution is subject to the Boost Software | |
4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
5 | // http://www.boost.org/LICENSE_1_0.txt) | |
6 | ||
7 | // Authors: Matthias Troyer | |
8 | ||
9 | #ifndef BOOST_MPI_DETAIL_FORWARD_SKELETON_IARCHIVE_HPP | |
10 | #define BOOST_MPI_DETAIL_FORWARD_SKELETON_IARCHIVE_HPP | |
11 | ||
12 | #include <boost/archive/detail/auto_link_archive.hpp> | |
13 | #include <boost/archive/detail/iserializer.hpp> | |
14 | #include <boost/archive/detail/interface_iarchive.hpp> | |
15 | #include <boost/archive/detail/common_iarchive.hpp> | |
16 | #include <boost/serialization/collection_size_type.hpp> | |
17 | ||
18 | namespace boost { namespace mpi { namespace detail { | |
19 | ||
20 | template<class Archive, class ImplementationArchive> | |
21 | class forward_skeleton_iarchive | |
22 | : public archive::detail::common_iarchive<Archive> | |
23 | { | |
24 | public: | |
25 | ||
26 | typedef ImplementationArchive implementation_archive_type; | |
27 | ||
28 | forward_skeleton_iarchive(implementation_archive_type& ar) | |
29 | : archive::detail::common_iarchive<Archive>(archive::no_header), | |
30 | implementation_archive(ar) | |
31 | { | |
32 | } | |
33 | ||
34 | #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS | |
35 | public: | |
36 | #else | |
37 | friend class archive::detail::interface_iarchive<Archive>; | |
38 | friend class archive::load_access; | |
39 | protected: | |
40 | #endif | |
41 | ||
42 | template<class T> | |
43 | void load_override(T & t) | |
44 | { | |
45 | archive::load(* this->This(), t); | |
46 | } | |
47 | ||
48 | #define BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(T) \ | |
49 | void load_override(T & t) \ | |
50 | { \ | |
51 | implementation_archive >> t; \ | |
52 | } | |
53 | ||
54 | BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_id_optional_type) | |
55 | BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::version_type) | |
56 | BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_id_type) | |
57 | BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_id_reference_type) | |
58 | BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::object_id_type) | |
59 | BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::object_reference_type) | |
60 | BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::tracking_type) | |
61 | BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_name_type) | |
62 | BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(serialization::collection_size_type) | |
63 | ||
64 | void load_override(std::string & s) | |
65 | { | |
66 | serialization::collection_size_type length(s.size()); | |
67 | load_override(length); | |
68 | s.resize(length); | |
69 | } | |
70 | ||
71 | #undef BOOST_ARCHIVE_FORWARD_IMPLEMENTATION | |
72 | protected: | |
73 | /// the actual archive used to serialize the information we actually want to store | |
74 | implementation_archive_type& implementation_archive; | |
75 | }; | |
76 | ||
77 | ||
78 | } } } // end namespace boost::mpi::detail | |
79 | ||
80 | #endif // BOOST_MPI_DETAIL_FORWARD_SKELETON_IARCHIVE_HPP |