]>
Commit | Line | Data |
---|---|---|
1 | // Copyright (C) 2006 Douglas Gregor <doug.gregor -at- gmail.com>. | |
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 | // Skeleton and content support for communicators | |
8 | ||
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 | |
13 | ||
14 | namespace boost { namespace mpi { | |
15 | ||
16 | template<typename T> | |
17 | void | |
18 | communicator::send(int dest, int tag, const skeleton_proxy<T>& proxy) const | |
19 | { | |
20 | packed_skeleton_oarchive ar(*this); | |
21 | ar << proxy.object; | |
22 | send(dest, tag, ar); | |
23 | } | |
24 | ||
25 | template<typename T> | |
26 | status | |
27 | communicator::recv(int source, int tag, const skeleton_proxy<T>& proxy) const | |
28 | { | |
29 | packed_skeleton_iarchive ar(*this); | |
30 | status result = recv(source, tag, ar); | |
31 | ar >> proxy.object; | |
32 | return result; | |
33 | } | |
34 | ||
35 | template<typename T> | |
36 | status communicator::recv(int source, int tag, skeleton_proxy<T>& proxy) const | |
37 | { | |
38 | packed_skeleton_iarchive ar(*this); | |
39 | status result = recv(source, tag, ar); | |
40 | ar >> proxy.object; | |
41 | return result; | |
42 | } | |
43 | ||
44 | template<typename T> | |
45 | request | |
46 | communicator::isend(int dest, int tag, const skeleton_proxy<T>& proxy) const | |
47 | { | |
48 | shared_ptr<packed_skeleton_oarchive> | |
49 | archive(new packed_skeleton_oarchive(*this)); | |
50 | ||
51 | *archive << proxy.object; | |
52 | request result = isend(dest, tag, *archive); | |
53 | result.preserve(archive); | |
54 | return result; | |
55 | } | |
56 | ||
57 | } } // end namespace boost::mpi | |
58 | ||
59 | #endif // BOOST_MPI_COMMUNICATOR_SC_HPP | |
60 |