annotate DEPENDENCIES/generic/include/boost/mpi/detail/forward_iprimitive.hpp @ 133:4acb5d8d80b6 tip

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