1 // (C) Copyright 2005 Matthias Troyer
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)
7 // Authors: Matthias Troyer
9 #include <boost/serialization/array.hpp>
11 #ifndef BOOST_MPI_DETAIL_FORWARD_IPRIMITIVE_HPP
12 #define BOOST_MPI_DETAIL_FORWARD_IPRIMITIVE_HPP
14 namespace boost { namespace mpi { namespace detail {
16 /// @brief a minimal input archive, which forwards reading to another archive
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
24 template <class ImplementationArchive>
25 class forward_iprimitive
29 /// the type of the archive to which the loading of primitive types will be forwarded
30 typedef ImplementationArchive implementation_archive_type;
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)
37 /// binary loading is forwarded to the implementation archive
38 void load_binary(void * address, std::size_t count )
40 implementation_archive.load_binary(address,count);
43 /// loading of arrays is forwarded to the implementation archive
45 void load_array(serialization::array_wrapper<T> & x, unsigned int file_version )
47 implementation_archive.load_array(x,file_version);
50 typedef typename ImplementationArchive::use_array_optimization use_array_optimization;
52 #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
53 friend class archive::load_access;
59 /// loading of primitives is forwarded to the implementation archive
63 implementation_archive >> t;
67 implementation_archive_type& implementation_archive;
70 } } } // end namespace boost::mpi::detail
72 #endif // BOOST_MPI_DETAIL_FORWARD_IPRIMITIVE_HPP