/Src/Dependencies/Boost/boost/graph/parallel/detail/untracked_pair.hpp

http://hadesmem.googlecode.com/ · C++ Header · 85 lines · 53 code · 19 blank · 13 comment · 0 complexity · cbbc626781609f932241be388ce39d75 MD5 · raw file

  1. // Copyright (C) 2007 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. //
  6. // This file contains helper data structures for use in transmitting
  7. // properties. The basic idea is to optimize away any storage for the
  8. // properties when no properties are specified.
  9. #ifndef BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP
  10. #define BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP
  11. #ifndef BOOST_GRAPH_USE_MPI
  12. #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
  13. #endif
  14. #include <boost/mpi/datatype.hpp>
  15. #include <utility> // for std::pair
  16. #include <boost/serialization/utility.hpp>
  17. namespace boost { namespace parallel { namespace detail {
  18. /**
  19. * This structure is like std::pair, with the only difference
  20. * that tracking in the serialization library is turned off.
  21. */
  22. template<typename T, typename U>
  23. struct untracked_pair : public std::pair<T,U>
  24. {
  25. untracked_pair() {}
  26. untracked_pair(const T& t, const U& u)
  27. : std::pair<T,U>(t,u) {}
  28. template<class T1, class U1>
  29. untracked_pair(std::pair<T1,U1> const& p)
  30. : std::pair<T,U>(p) {}
  31. };
  32. template<typename T, typename U>
  33. inline untracked_pair<T, U>
  34. make_untracked_pair(const T& t, const U& u)
  35. {
  36. return untracked_pair<T,U>(t,u);
  37. }
  38. } } } // end namespace boost::parallel::detail
  39. namespace boost { namespace mpi {
  40. template<typename T, typename U>
  41. struct is_mpi_datatype<boost::parallel::detail::untracked_pair<T, U> >
  42. : is_mpi_datatype<std::pair<T,U> > {};
  43. } } // end namespace boost::mpi
  44. namespace boost { namespace serialization {
  45. // pair
  46. template<class Archive, class F, class S>
  47. inline void serialize(
  48. Archive & ar,
  49. boost::parallel::detail::untracked_pair<F, S> & p,
  50. const unsigned int /* file_version */
  51. ){
  52. ar & boost::serialization::make_nvp("first", p.first);
  53. ar & boost::serialization::make_nvp("second", p.second);
  54. }
  55. template<typename T, typename U>
  56. struct is_bitwise_serializable<
  57. boost::parallel::detail::untracked_pair<T, U> >
  58. : is_bitwise_serializable<std::pair<T, U> > {};
  59. template<typename T, typename U>
  60. struct implementation_level<boost::parallel::detail::untracked_pair<T, U> >
  61. : mpl::int_<object_serializable> {} ;
  62. template<typename T, typename U>
  63. struct tracking_level<boost::parallel::detail::untracked_pair<T, U> >
  64. : mpl::int_<track_never> {} ;
  65. } } // end namespace boost::serialization
  66. #endif // BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP