annotate DEPENDENCIES/generic/include/boost/mpi/detail/forward_oprimitive.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // (C) Copyright 2005 Matthias Troyer
Chris@16 2
Chris@16 3 // Use, modification and distribution is subject to the Boost Software
Chris@16 4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 5 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6
Chris@16 7 // Authors: Matthias Troyer
Chris@16 8
Chris@16 9 #ifndef BOOST_MPI_DETAIL_FORWARD_OPRIMITIVE_HPP
Chris@16 10 #define BOOST_MPI_DETAIL_FORWARD_OPRIMITIVE_HPP
Chris@16 11
Chris@16 12 #include <boost/config.hpp>
Chris@16 13 #include <boost/serialization/array.hpp>
Chris@16 14
Chris@16 15 namespace boost { namespace mpi { namespace detail {
Chris@16 16
Chris@16 17 /// @brief a minimal output archive, which forwards saving to another archive
Chris@16 18 ///
Chris@16 19 /// This class template is designed to use the saving facilities of another
Chris@16 20 /// output archive (the "implementation archive", whose type is specified by
Chris@16 21 /// the template argument, to handle serialization of primitive types,
Chris@16 22 /// while serialization for specific types can be overriden independently
Chris@16 23 /// of that archive.
Chris@16 24
Chris@16 25 template <class ImplementationArchive>
Chris@16 26 class forward_oprimitive
Chris@16 27 {
Chris@16 28 public:
Chris@16 29
Chris@16 30 /// the type of the archive to which the saving of primitive types will be forwarded
Chris@16 31 typedef ImplementationArchive implementation_archive_type;
Chris@16 32
Chris@16 33 /// the constructor takes a reference to the implementation archive used for saving primitve types
Chris@16 34 forward_oprimitive(implementation_archive_type& ar)
Chris@16 35 : implementation_archive(ar)
Chris@16 36 {}
Chris@16 37
Chris@16 38 /// binary saving is forwarded to the implementation archive
Chris@16 39 void save_binary(const void * address, std::size_t count)
Chris@16 40 {
Chris@16 41 implementation_archive.save_binary(address,count);
Chris@16 42 }
Chris@16 43
Chris@16 44 /// saving of arrays is forwarded to the implementation archive
Chris@16 45 template<class T>
Chris@16 46 void save_array(serialization::array<T> const& x, unsigned int file_version )
Chris@16 47 {
Chris@16 48 implementation_archive.save_array(x,file_version);
Chris@16 49 }
Chris@16 50
Chris@16 51 typedef typename ImplementationArchive::use_array_optimization use_array_optimization;
Chris@16 52
Chris@16 53 #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
Chris@16 54 friend class archive::save_access;
Chris@16 55 protected:
Chris@16 56 #else
Chris@16 57 public:
Chris@16 58 #endif
Chris@16 59
Chris@16 60 /// saving of primitives is forwarded to the implementation archive
Chris@16 61 template<class T>
Chris@16 62 void save(const T & t)
Chris@16 63 {
Chris@16 64 implementation_archive << t;
Chris@16 65 }
Chris@16 66
Chris@16 67 private:
Chris@16 68 implementation_archive_type& implementation_archive;
Chris@16 69 };
Chris@16 70
Chris@16 71 } } } // end namespace boost::mpi::detail
Chris@16 72
Chris@16 73 #endif // BOOST_MPI_DETAIL_FORWARD_OPRIMITIVE_HPP