1 // Copyright (C) 2006 Douglas Gregor <doug.gregor -at- gmail.com>.
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 // Skeleton and content support for communicators
9 // This header should be included only after both communicator.hpp and
10 // skeleton_and_content.hpp have been included.
11 #ifndef BOOST_MPI_COMMUNICATOR_SC_HPP
12 #define BOOST_MPI_COMMUNICATOR_SC_HPP
14 namespace boost
{ namespace mpi
{
18 communicator::send(int dest
, int tag
, const skeleton_proxy
<T
>& proxy
) const
20 packed_skeleton_oarchive
ar(*this);
27 communicator::recv(int source
, int tag
, const skeleton_proxy
<T
>& proxy
) const
29 packed_skeleton_iarchive
ar(*this);
30 status result
= recv(source
, tag
, ar
);
36 status
communicator::recv(int source
, int tag
, skeleton_proxy
<T
>& proxy
) const
38 packed_skeleton_iarchive
ar(*this);
39 status result
= recv(source
, tag
, ar
);
46 communicator::isend(int dest
, int tag
, const skeleton_proxy
<T
>& proxy
) const
48 shared_ptr
<packed_skeleton_oarchive
>
49 archive(new packed_skeleton_oarchive(*this));
51 *archive
<< proxy
.object
;
52 request result
= isend(dest
, tag
, *archive
);
53 result
.m_data
= archive
;
59 struct serialized_irecv_data
<const skeleton_proxy
<T
> >
61 serialized_irecv_data(const communicator
& comm
, int source
, int tag
,
62 skeleton_proxy
<T
> proxy
)
63 : comm(comm
), source(source
), tag(tag
), isa(comm
),
64 ia(isa
.get_skeleton()), proxy(proxy
) { }
66 void deserialize(status
& stat
)
76 packed_skeleton_iarchive isa
;
78 skeleton_proxy
<T
> proxy
;
82 struct serialized_irecv_data
<skeleton_proxy
<T
> >
83 : public serialized_irecv_data
<const skeleton_proxy
<T
> >
85 typedef serialized_irecv_data
<const skeleton_proxy
<T
> > inherited
;
87 serialized_irecv_data(const communicator
& comm
, int source
, int tag
,
88 const skeleton_proxy
<T
>& proxy
)
89 : inherited(comm
, source
, tag
, proxy
) { }
93 } } // end namespace boost::mpi
95 #endif // BOOST_MPI_COMMUNICATOR_SC_HPP