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)
9 * This header defines the class @c request, which contains a request
10 * for non-blocking communication.
12 #ifndef BOOST_MPI_REQUEST_HPP
13 #define BOOST_MPI_REQUEST_HPP
15 #include <boost/mpi/config.hpp>
16 #include <boost/optional.hpp>
17 #include <boost/shared_ptr.hpp>
18 #include <boost/mpi/packed_iarchive.hpp>
20 namespace boost
{ namespace mpi
{
26 * @brief A request for a non-blocking send or receive.
28 * This structure contains information about a non-blocking send or
29 * receive and will be returned from @c isend or @c irecv,
32 class BOOST_MPI_DECL request
36 * Constructs a NULL request.
41 * Wait until the communication associated with this request has
42 * completed, then return a @c status object describing the
48 * Determine whether the communication associated with this request
49 * has completed successfully. If so, returns the @c status object
50 * describing the communication. Otherwise, returns an empty @c
51 * optional<> to indicate that the communication has not completed
52 * yet. Note that once @c test() returns a @c status object, the
53 * request has completed and @c wait() should not be called.
55 optional
<status
> test();
58 * Cancel a pending communication, assuming it has not already been
64 enum request_action
{ ra_wait
, ra_test
, ra_cancel
};
65 typedef optional
<status
> (*handler_type
)(request
* self
,
66 request_action action
);
71 * Handles the non-blocking receive of a serialized value.
74 static optional
<status
>
75 handle_serialized_irecv(request
* self
, request_action action
);
80 * Handles the non-blocking receive of an array of serialized values.
83 static optional
<status
>
84 handle_serialized_array_irecv(request
* self
, request_action action
);
86 public: // template friends are not portable
89 MPI_Request m_requests
[2];
92 handler_type m_handler
;
95 shared_ptr
<void> m_data
;
97 friend class communicator
;
100 } } // end namespace boost::mpi
102 #endif // BOOST_MPI_REQUEST_HPP