]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/mpi/detail/forward_skeleton_oarchive.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / mpi / detail / forward_skeleton_oarchive.hpp
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_OARCHIVE_HPP
10 #define BOOST_MPI_DETAIL_FORWARD_SKELETON_OARCHIVE_HPP
11
12 #include <boost/archive/detail/auto_link_archive.hpp>
13 #include <boost/archive/detail/oserializer.hpp>
14 #include <boost/archive/detail/interface_oarchive.hpp>
15 #include <boost/archive/detail/common_oarchive.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_oarchive
22 : public archive::detail::common_oarchive<Archive>
23 {
24 public:
25
26 typedef ImplementationArchive implementation_archive_type;
27
28 forward_skeleton_oarchive(implementation_archive_type& ar)
29 : archive::detail::common_oarchive<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_oarchive<Archive>;
38 friend class archive::save_access;
39 protected:
40 #endif
41
42 template<class T>
43 void save_override(T const& t)
44 {
45 archive::save(* this->This(), t);
46 }
47
48 #define BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(T) \
49 void save_override(T const & 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 save_override(std::string const & t)
65 {
66 save_override(serialization::collection_size_type(t.size()));
67 }
68
69
70 #undef BOOST_ARCHIVE_FORWARD_IMPLEMENTATION
71 protected:
72 /// the actual archive used to serialize the information we actually want to store
73 implementation_archive_type& implementation_archive;
74 };
75
76 } } } // end namespace boost::mpi::detail
77
78 #endif // BOOST_MPI_DETAIL_FORWARD_SKELETON_OARCHIVE_HPP