| Home | Libraries | People | FAQ | More

## Class request

boost::mpi::request — A request for a non-blocking send or receive.

## Synopsis

    // In header: <boost/mpi/request.hpp>

    class request {
    public:
      // member classes/structs/unions

      class handler {
      public:
        // construct/copy/destruct
        ~handler();

        // public member functions
        virtual status wait() = 0;
        virtual optional< status > test() = 0;
        virtual void cancel() = 0;
        virtual bool active() const = 0;
        virtual optional< MPI_Request & > trivial() = 0;
      };
      template<typename T, typename A>
      class legacy_dynamic_primitive_array_handler {
      };
      template<typename T>
      class legacy_serialized_array_handler {
      };
      template<typename T>
      class legacy_serialized_handler {
      };
      // construct/copy/destruct
      request();
      request(handler *);

      // public member functions
      status wait();
      optional< status > test();
      void cancel();
      optional< MPI_Request & > trivial();
      bool active() const;
      void preserve(boost::shared_ptr< void >);

      // public static functions
      template<typename T>
        static request
        make_trivial_send(communicator const &, int, int, T const &);
      template<typename T>
        static request
        make_trivial_send(communicator const &, int, int, T const *, int);
      static request
      make_packed_send(communicator const &, int, int, void const *, std::size_t);
      static request
      make_bottom_send(communicator const &, int, int, MPI_Datatype);
      static request make_empty_send(communicator const &, int, int);
      template<typename T>
        static request make_trivial_recv(communicator const &, int, int, T &);
      template<typename T>
        static request make_trivial_recv(communicator const &, int, int, T *, int);
      static request
      make_bottom_recv(communicator const &, int, int, MPI_Datatype);
      static request make_empty_recv(communicator const &, int, int);
      static request make_dynamic();
      template<typename T>
        static request make_serialized(communicator const &, int, int, T &);
      template<typename T>
        static request
        make_serialized_array(communicator const &, int, int, T *, int);
      template<typename T, typename A>
        static request
        make_dynamic_primitive_array_recv(communicator const &, int, int,
                                          std::vector< T, A > &);
      template<typename T, typename A>
        static request
        make_dynamic_primitive_array_send(communicator const &, int, int,
                                          std::vector< T, A > const &);
    };

## Description

This structure contains information about a non-blocking send or receive and will be returned from `isend` or `irecv`, respectively.

### `request` public construct/copy/destruct

1.     request();

   Constructs a NULL request.

2.     request(handler * h);

### `request` public member functions

1.     status wait();

   Wait until the communication associated with this request has completed, then return a `status` object describing the communication.

2.     optional< status > test();

   Determine whether the communication associated with this request has completed successfully. If so, returns the `status` object describing the communication. Otherwise, returns an empty `optional<>` to indicate that the communication has not completed yet. Note that once `test()` returns a `status` object, the request has completed and `wait()` should not be called.

3.     void cancel();

   Cancel a pending communication, assuming it has not already been completed.

4.     optional< MPI_Request & > trivial();

   The trivial MPI requet implenting this request, provided it's trivial. Probably irrelevant to most users.

5.     bool active() const;

   Is this request potentialy pending ?

6.     void preserve(boost::shared_ptr< void > d);

### `request` public static functions

1.     template<typename T>
         static request
         make_trivial_send(communicator const & comm, int dest, int tag,
                           T const & value);

   Send a known number of primitive objects in one MPI request.

2.     template<typename T>
         static request
         make_trivial_send(communicator const & comm, int dest, int tag,
                           T const * values, int n);

3.     static request
       make_packed_send(communicator const & comm, int dest, int tag,
                        void const * values, std::size_t n);

4.     static request
       make_bottom_send(communicator const & comm, int dest, int tag,
                        MPI_Datatype tp);

5.     static request make_empty_send(communicator const & comm, int dest, int tag);

6.     template<typename T>
         static request
         make_trivial_recv(communicator const & comm, int dest, int tag, T & value);

   Receive a known number of primitive objects in one MPI request.

7.     template<typename T>
         static request
         make_trivial_recv(communicator const & comm, int dest, int tag, T * values,
                           int n);

8.     static request
       make_bottom_recv(communicator const & comm, int dest, int tag,
                        MPI_Datatype tp);

9.     static request make_empty_recv(communicator const & comm, int dest, int tag);

10.     static request make_dynamic();

    Construct request for simple data of unknown size.

11.     template<typename T>
          static request
          make_serialized(communicator const & comm, int source, int tag, T & value);

    Constructs request for serialized data.

12.     template<typename T>
          static request
          make_serialized_array(communicator const & comm, int source, int tag,
                                T * values, int n);

    Constructs request for array of complex data.

13.     template<typename T, typename A>
          static request
          make_dynamic_primitive_array_recv(communicator const & comm, int source,
                                            int tag, std::vector< T, A > & values);

    Request to recv array of primitive data.

14.     template<typename T, typename A>
          static request
          make_dynamic_primitive_array_send(communicator const & comm, int source,
                                            int tag,
                                            std::vector< T, A > const & values);

    Request to send array of primitive data.