PageRenderTime 44ms CodeModel.GetById 39ms app.highlight 4ms RepoModel.GetById 0ms app.codeStats 1ms

/Src/Dependencies/Boost/boost/mpi/detail/forward_skeleton_iarchive.hpp

http://hadesmem.googlecode.com/
C++ Header | 84 lines | 57 code | 18 blank | 9 comment | 0 complexity | f0c683c03386b4d5e4e151788289cbbf MD5 | raw file
 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_IARCHIVE_HPP
10#define BOOST_MPI_DETAIL_FORWARD_SKELETON_IARCHIVE_HPP
11
12#include <boost/serialization/pfto.hpp>
13
14#include <boost/archive/detail/auto_link_archive.hpp>
15#include <boost/archive/detail/iserializer.hpp>
16#include <boost/archive/detail/interface_iarchive.hpp>
17#include <boost/archive/detail/common_iarchive.hpp>
18#include <boost/serialization/collection_size_type.hpp>
19
20namespace boost { namespace mpi { namespace detail {
21
22template<class Archive, class ImplementationArchive>
23class forward_skeleton_iarchive 
24  : public archive::detail::common_iarchive<Archive>
25{
26public:
27
28    typedef ImplementationArchive implementation_archive_type;
29
30    forward_skeleton_iarchive(implementation_archive_type& ar) 
31      : archive::detail::common_iarchive<Archive>(archive::no_header),
32        implementation_archive(ar)
33    {
34    }
35
36#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
37public:
38#else
39    friend class archive::detail::interface_iarchive<Archive>;
40    friend class archive::load_access;
41protected:
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 load_override(T & t, BOOST_PFTO int)
49    {
50        archive::load(* this->This(), t);
51    }
52
53#define BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(T) \
54    void load_override(T & t , int)             \
55    {                                           \
56      implementation_archive >> t;              \
57    }
58
59BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_id_optional_type)
60BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::version_type)
61BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_id_type)
62BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_id_reference_type)
63BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::object_id_type)
64BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::tracking_type)
65BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_name_type)
66BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(serialization::collection_size_type)
67
68    void load_override(std::string & s , int)    
69    {                            
70      serialization::collection_size_type length(s.size());              
71      load_override(length,0);       
72      s.resize(length);
73    }
74
75#undef BOOST_ARCHIVE_FORWARD_IMPLEMENTATION
76protected:
77    /// the actual archive used to serialize the information we actually want to store
78    implementation_archive_type& implementation_archive;
79};
80
81
82} } } // end namespace boost::mpi::detail
83
84#endif // BOOST_MPI_DETAIL_FORWARD_SKELETON_IARCHIVE_HPP