]> git.sesse.net Git - casparcg/blob - dependencies/boost/boost/mpi/detail/forward_skeleton_oarchive.hpp
Manually merged pull request #222
[casparcg] / dependencies / boost / boost / mpi / detail / forward_skeleton_oarchive.hpp
1 // (C) Copyright 2005 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 // http://www.boost.org/LICENSE_1_0.txt)
6
7 //  Authors: Matthias Troyer
8
9 #ifndef BOOST_MPI_DETAIL_FORWARD_SKELETON_OARCHIVE_HPP
10 #define BOOST_MPI_DETAIL_FORWARD_SKELETON_OARCHIVE_HPP
11
12 #include <boost/serialization/pfto.hpp>
13
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>
19
20 namespace boost { namespace mpi { namespace detail {
21
22 template<class Archive, class ImplementationArchive>
23 class forward_skeleton_oarchive 
24   : public archive::detail::common_oarchive<Archive>
25 {
26 public:
27
28     typedef ImplementationArchive implementation_archive_type;
29
30     forward_skeleton_oarchive(implementation_archive_type& ar) 
31       : archive::detail::common_oarchive<Archive>(archive::no_header),
32         implementation_archive(ar)
33     {
34     }
35
36 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
37 public:
38 #else
39     friend class archive::detail::interface_oarchive<Archive>;
40     friend class archive::save_access;
41 protected:
42 #endif
43
44     // intermediate level to support override of operators
45     // for templates in the absence of partial function 
46     // template ordering
47     template<class T>
48     void save_override(T const& t, BOOST_PFTO int)
49     {
50         archive::save(* this->This(), t);
51     }
52
53 #define BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(T) \
54     void save_override(T const & t , int)       \
55     {                                           \
56       implementation_archive << t;              \
57     }
58
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)
68
69     void save_override(std::string const & t , int)    
70     {                                          
71       save_override(serialization::collection_size_type(t.size()),0);       
72     }
73
74
75 #undef BOOST_ARCHIVE_FORWARD_IMPLEMENTATION
76 protected:
77     /// the actual archive used to serialize the information we actually want to store
78     implementation_archive_type& implementation_archive;
79 };
80
81 } } } // end namespace boost::mpi::detail
82
83 #endif // BOOST_MPI_DETAIL_FORWARD_SKELETON_OARCHIVE_HPP