Chris@16: // (C) Copyright 2005 Matthias Troyer Chris@16: Chris@16: // Use, modification and distribution is subject to the Boost Software Chris@16: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // Authors: Matthias Troyer Chris@16: Chris@16: #include Chris@16: Chris@16: #ifndef BOOST_MPI_DETAIL_FORWARD_IPRIMITIVE_HPP Chris@16: #define BOOST_MPI_DETAIL_FORWARD_IPRIMITIVE_HPP Chris@16: Chris@16: namespace boost { namespace mpi { namespace detail { Chris@16: Chris@16: /// @brief a minimal input archive, which forwards reading to another archive Chris@16: /// Chris@16: /// This class template is designed to use the loading facilities of another Chris@16: /// input archive (the "implementation archive", whose type is specified by Chris@16: /// the template argument, to handle serialization of primitive types, Chris@16: /// while serialization for specific types can be overriden independently Chris@16: /// of that archive. Chris@16: Chris@16: template Chris@16: class forward_iprimitive Chris@16: { Chris@16: public: Chris@16: Chris@16: /// the type of the archive to which the loading of primitive types will be forwarded Chris@16: typedef ImplementationArchive implementation_archive_type; Chris@16: Chris@16: /// the constructor takes a reference to the implementation archive used for loading primitve types Chris@16: forward_iprimitive(implementation_archive_type& ar) Chris@16: : implementation_archive(ar) Chris@16: {} Chris@16: Chris@16: /// binary loading is forwarded to the implementation archive Chris@16: void load_binary(void * address, std::size_t count ) Chris@16: { Chris@16: implementation_archive.load_binary(address,count); Chris@16: } Chris@16: Chris@16: /// loading of arrays is forwarded to the implementation archive Chris@16: template Chris@16: void load_array(serialization::array & x, unsigned int file_version ) Chris@16: { Chris@16: implementation_archive.load_array(x,file_version); Chris@16: } Chris@16: Chris@16: typedef typename ImplementationArchive::use_array_optimization use_array_optimization; Chris@16: Chris@16: #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS Chris@16: friend class archive::load_access; Chris@16: protected: Chris@16: #else Chris@16: public: Chris@16: #endif Chris@16: Chris@16: /// loading of primitives is forwarded to the implementation archive Chris@16: template Chris@16: void load(T & t) Chris@16: { Chris@16: implementation_archive >> t; Chris@16: } Chris@16: Chris@16: private: Chris@16: implementation_archive_type& implementation_archive; Chris@16: }; Chris@16: Chris@16: } } } // end namespace boost::mpi::detail Chris@16: Chris@16: #endif // BOOST_MPI_DETAIL_FORWARD_IPRIMITIVE_HPP