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 #ifndef BOOST_MPI_DETAIL_IGNORE_IPRIMITIVE_HPP
10 #define BOOST_MPI_DETAIL_IGNORE_IPRIMITIVE_HPP
11 
12 #include <boost/config.hpp>
13 #include <boost/mpi/datatype.hpp>
14 #include <boost/serialization/array.hpp>
15 
16 
17 namespace boost { namespace mpi { namespace detail {
18 
19 /// @brief a minimal input archive, which ignores any load
20 ///
21 /// This class implements a minimal input archive, probably an input archive
22 /// archetype, doing nothing at any load. It's use, besides acting as an
23 /// archetype is as a base class to implement special archives that ignore
24 /// loading of most types
25 
26 class ignore_iprimitive
27 {
28 public:
29     /// a trivial default constructor
ignore_iprimitive()30     ignore_iprimitive()
31     {}
32 
33 
34         /// don't do anything when loading binary data
load_binary(void *,std::size_t)35     void load_binary(void *, std::size_t )
36         {}
37 
38         /// don't do anything when loading arrays
39     template<class T>
load_array(serialization::array_wrapper<T> &,unsigned int)40     void load_array(serialization::array_wrapper<T> &, unsigned int )
41     {}
42 
43     typedef is_mpi_datatype<mpl::_1> use_array_optimization;
44 
45         /// don't do anything when loading primitive types
46     template<class T>
load(T &)47     void load(T &)
48     {
49     }
50 };
51 
52 } } } // end namespace boost::mpi::detail
53 
54 #endif // BOOST_MPI_DETAIL_IGNORE_IPRIMITIVE_HPP
55