ignore_skeleton_oarchive.hpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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_SKELETON_OARCHIVE_HPP
  7. #define BOOST_MPI_DETAIL_IGNORE_SKELETON_OARCHIVE_HPP
  8. #include <boost/archive/detail/auto_link_archive.hpp>
  9. #include <boost/archive/detail/common_oarchive.hpp>
  10. #include <boost/archive/basic_archive.hpp>
  11. #include <boost/archive/detail/oserializer.hpp>
  12. #include <boost/serialization/collection_size_type.hpp>
  13. #include <boost/serialization/array.hpp>
  14. #include <boost/serialization/library_version_type.hpp>
  15. #include <boost/serialization/item_version_type.hpp>
  16. namespace boost { namespace mpi { namespace detail {
  17. template<class Archive>
  18. class ignore_skeleton_oarchive
  19. : public archive::detail::common_oarchive<Archive>
  20. {
  21. public:
  22. ignore_skeleton_oarchive()
  23. : archive::detail::common_oarchive<Archive>(archive::no_header)
  24. {
  25. }
  26. #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
  27. public:
  28. #else
  29. friend class archive::detail::interface_oarchive<Archive>;
  30. friend class archive::save_access;
  31. protected:
  32. #endif
  33. template<class T>
  34. void save_override(T const& t)
  35. {
  36. archive::save(* this->This(), t);
  37. }
  38. #define BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(T) \
  39. void save_override(T const &) \
  40. {}
  41. BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::class_id_optional_type)
  42. BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::version_type)
  43. BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::class_id_type)
  44. BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::class_id_reference_type)
  45. BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::object_id_type)
  46. BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::object_reference_type)
  47. BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::tracking_type)
  48. BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::class_name_type)
  49. BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(serialization::collection_size_type)
  50. BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(serialization::library_version_type)
  51. BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(serialization::item_version_type)
  52. void save_override(std::string const & s)
  53. {
  54. if (s.size())
  55. save_override(serialization::make_array(s.data(),s.size()));
  56. }
  57. #undef BOOST_ARCHIVE_IGNORE_IMPLEMENTATION
  58. };
  59. } } } // end namespace boost::mpi::detail
  60. #endif // BOOST_MPI_DETAIL_IGNORE_SKELETON_OARCHIVE_HPP