]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/mpi/detail/forward_iprimitive.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / mpi / detail / forward_iprimitive.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 #include <boost/serialization/array.hpp>
10
11 #ifndef BOOST_MPI_DETAIL_FORWARD_IPRIMITIVE_HPP
12 #define BOOST_MPI_DETAIL_FORWARD_IPRIMITIVE_HPP
13
14 namespace boost { namespace mpi { namespace detail {
15
16 /// @brief a minimal input archive, which forwards reading to another archive
17 ///
18 /// This class template is designed to use the loading facilities of another
19 /// input archive (the "implementation archive", whose type is specified by
20 /// the template argument, to handle serialization of primitive types,
21 /// while serialization for specific types can be overriden independently
22 /// of that archive.
23
24 template <class ImplementationArchive>
25 class forward_iprimitive
26 {
27 public:
28
29 /// the type of the archive to which the loading of primitive types will be forwarded
30 typedef ImplementationArchive implementation_archive_type;
31
32 /// the constructor takes a reference to the implementation archive used for loading primitve types
33 forward_iprimitive(implementation_archive_type& ar)
34 : implementation_archive(ar)
35 {}
36
37 /// binary loading is forwarded to the implementation archive
38 void load_binary(void * address, std::size_t count )
39 {
40 implementation_archive.load_binary(address,count);
41 }
42
43 /// loading of arrays is forwarded to the implementation archive
44 template<class T>
45 void load_array(serialization::array_wrapper<T> & x, unsigned int file_version )
46 {
47 implementation_archive.load_array(x,file_version);
48 }
49
50 typedef typename ImplementationArchive::use_array_optimization use_array_optimization;
51
52 #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
53 friend class archive::load_access;
54 protected:
55 #else
56 public:
57 #endif
58
59 /// loading of primitives is forwarded to the implementation archive
60 template<class T>
61 void load(T & t)
62 {
63 implementation_archive >> t;
64 }
65
66 private:
67 implementation_archive_type& implementation_archive;
68 };
69
70 } } } // end namespace boost::mpi::detail
71
72 #endif // BOOST_MPI_DETAIL_FORWARD_IPRIMITIVE_HPP