ignore_iprimitive.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // (C) Copyright 2005 Matthias Troyer
  2. // Use, modification and distribution is subject to the Boost Software
  3. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // Authors: Matthias Troyer
  6. #ifndef BOOST_MPI_DETAIL_IGNORE_IPRIMITIVE_HPP
  7. #define BOOST_MPI_DETAIL_IGNORE_IPRIMITIVE_HPP
  8. #include <boost/config.hpp>
  9. #include <boost/mpi/datatype.hpp>
  10. #include <boost/serialization/array.hpp>
  11. namespace boost { namespace mpi { namespace detail {
  12. /// @brief a minimal input archive, which ignores any load
  13. ///
  14. /// This class implements a minimal input archive, probably an input archive
  15. /// archetype, doing nothing at any load. It's use, besides acting as an
  16. /// archetype is as a base class to implement special archives that ignore
  17. /// loading of most types
  18. class ignore_iprimitive
  19. {
  20. public:
  21. /// a trivial default constructor
  22. ignore_iprimitive()
  23. {}
  24. /// don't do anything when loading binary data
  25. void load_binary(void *, std::size_t )
  26. {}
  27. /// don't do anything when loading arrays
  28. template<class T>
  29. void load_array(serialization::array_wrapper<T> &, unsigned int )
  30. {}
  31. typedef is_mpi_datatype<mpl::_1> use_array_optimization;
  32. /// don't do anything when loading primitive types
  33. template<class T>
  34. void load(T &)
  35. {
  36. }
  37. };
  38. } } } // end namespace boost::mpi::detail
  39. #endif // BOOST_MPI_DETAIL_IGNORE_IPRIMITIVE_HPP