1 // (C) Copyright 2005 Matthias Troyer
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)
7 // Authors: Matthias Troyer
9 #ifndef BOOST_MPI_DETAIL_FORWARD_SKELETON_OARCHIVE_HPP
10 #define BOOST_MPI_DETAIL_FORWARD_SKELETON_OARCHIVE_HPP
12 #include <boost/serialization/pfto.hpp>
14 #include <boost/archive/detail/auto_link_archive.hpp>
15 #include <boost/archive/detail/oserializer.hpp>
16 #include <boost/archive/detail/interface_oarchive.hpp>
17 #include <boost/archive/detail/common_oarchive.hpp>
18 #include <boost/serialization/collection_size_type.hpp>
20 namespace boost { namespace mpi { namespace detail {
22 template<class Archive, class ImplementationArchive>
23 class forward_skeleton_oarchive
24 : public archive::detail::common_oarchive<Archive>
28 typedef ImplementationArchive implementation_archive_type;
30 forward_skeleton_oarchive(implementation_archive_type& ar)
31 : archive::detail::common_oarchive<Archive>(archive::no_header),
32 implementation_archive(ar)
36 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
39 friend class archive::detail::interface_oarchive<Archive>;
40 friend class archive::save_access;
44 // intermediate level to support override of operators
45 // for templates in the absence of partial function
48 void save_override(T const& t, BOOST_PFTO int)
50 archive::save(* this->This(), t);
53 #define BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(T) \
54 void save_override(T const & t , int) \
56 implementation_archive << t; \
59 BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_id_optional_type)
60 BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::version_type)
61 BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_id_type)
62 BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_id_reference_type)
63 BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::object_id_type)
64 BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::object_reference_type)
65 BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::tracking_type)
66 BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_name_type)
67 BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(serialization::collection_size_type)
69 void save_override(std::string const & t , int)
71 save_override(serialization::collection_size_type(t.size()),0);
75 #undef BOOST_ARCHIVE_FORWARD_IMPLEMENTATION
77 /// the actual archive used to serialize the information we actually want to store
78 implementation_archive_type& implementation_archive;
81 } } } // end namespace boost::mpi::detail
83 #endif // BOOST_MPI_DETAIL_FORWARD_SKELETON_OARCHIVE_HPP