property_serialize.hpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // (C) Copyright Jeremy Siek 2006
  2. // Distributed under the Boost Software License, Version 1.0. (See
  3. // accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_PROPERTY_SERIALIZE_HPP
  6. #define BOOST_PROPERTY_SERIALIZE_HPP
  7. #include <boost/pending/property.hpp>
  8. #ifdef BOOST_GRAPH_USE_MPI
  9. #include <boost/mpi/datatype.hpp>
  10. #include <boost/serialization/is_bitwise_serializable.hpp>
  11. #endif // BOOST_GRAPH_USE_MPI
  12. #include <boost/serialization/base_object.hpp>
  13. #include <boost/serialization/nvp.hpp>
  14. namespace boost {
  15. template<class Archive>
  16. inline void serialize(Archive&, no_property&, const unsigned int) { }
  17. template<class Archive, class Tag, class T, class Base>
  18. void
  19. serialize(Archive& ar, property<Tag, T, Base>& prop,
  20. const unsigned int /*version*/)
  21. {
  22. ar & serialization::make_nvp( "property_value" , prop.m_value );
  23. ar & serialization::make_nvp( "property_base" , prop.m_base );
  24. }
  25. #ifdef BOOST_GRAPH_USE_MPI
  26. namespace mpi {
  27. template<typename Tag, typename T, typename Base>
  28. struct is_mpi_datatype<property<Tag, T, Base> >
  29. : mpl::and_<is_mpi_datatype<T>,
  30. is_mpi_datatype<Base> > { };
  31. }
  32. namespace serialization {
  33. template<typename Tag, typename T, typename Base>
  34. struct is_bitwise_serializable<property<Tag, T, Base> >
  35. : mpl::and_<is_bitwise_serializable<T>,
  36. is_bitwise_serializable<Base> > { };
  37. template<typename Tag, typename T, typename Base>
  38. struct implementation_level<property<Tag, T, Base> >
  39. : mpl::int_<object_serializable> {} ;
  40. template<typename Tag, typename T, typename Base>
  41. struct tracking_level<property<Tag, T, Base> >
  42. : mpl::int_<track_never> {} ;
  43. }
  44. #endif // BOOST_GRAPH_USE_MPI
  45. } // end namespace boost
  46. #ifdef BOOST_GRAPH_USE_MPI
  47. namespace boost { namespace mpi {
  48. template<>
  49. struct is_mpi_datatype<boost::no_property> : mpl::true_ { };
  50. } } // end namespace boost::mpi
  51. BOOST_IS_BITWISE_SERIALIZABLE(boost::no_property)
  52. BOOST_CLASS_IMPLEMENTATION(boost::no_property,object_serializable)
  53. BOOST_CLASS_TRACKING(boost::no_property,track_never)
  54. #endif // BOOST_GRAPH_USE_MPI
  55. #endif // BOOST_PROPERTY_SERIALIZE_HPP