Loading...
Searching...
No Matches
HydroCouple::Distributed::IExchangeRequest Class Referenceabstract

IExchangeRequest is a handle to an asynchronous communication operation. More...

#include <hydrocoupledistributed.h>

Collaboration diagram for HydroCouple::Distributed::IExchangeRequest:

Public Member Functions

virtual ~IExchangeRequest ()=default
 IExchangeRequest::~IExchangeRequest is a virtual destructor.
 
virtual bool cancel ()=0
 Asks the implementation to abandon the operation.
 
virtual bool test ()=0
 Non-blocking completion test.
 
virtual void wait ()=0
 Blocks until the operation completes.
 
virtual bool waitFor (double timeoutSeconds)=0
 Blocks until the operation completes or the timeout elapses.
 
virtual bool failed (std::string &message) const =0
 Checks whether the operation completed with an error.
 

Detailed Description

IExchangeRequest is a handle to an asynchronous communication operation.

Returned by the asynchronous ITransport operations and by IPartitionedComponentDataItem::synchronizeAsync(). Completion machinery (progress threads, transport polling) is owned by the implementing SDK; consumers only test or wait.

Constructor & Destructor Documentation

◆ ~IExchangeRequest()

virtual HydroCouple::Distributed::IExchangeRequest::~IExchangeRequest ( )
virtualdefault

IExchangeRequest::~IExchangeRequest is a virtual destructor.

Destroying an incomplete request always blocks until it completes — one behaviour, so that a caller who lets a request go out of scope can rely on its buffers being free afterwards. A caller that must not block bounds the wait with waitFor() and then asks for cancellation with cancel(); a request that is still pending after both is an operation the transport cannot abandon, and the caller treats the composition as failed rather than destroy it. See ITransport for when a transport completes a request whose peer is gone.

Member Function Documentation

◆ cancel()

virtual bool HydroCouple::Distributed::IExchangeRequest::cancel ( )
nodiscardpure virtual

Asks the implementation to abandon the operation.

Returns true if the request is now complete (cancelled, or it had already finished) and its buffers may be reused; false if this transport cannot cancel an in-flight operation, in which case the request is still pending and the caller must wait() as usual. Never blocks.

◆ failed()

virtual bool HydroCouple::Distributed::IExchangeRequest::failed ( std::string & message) const
nodiscardpure virtual

Checks whether the operation completed with an error.

Parameters
[out]messagedescribes the failure when the return value is true.
Returns
True if the operation failed.

◆ test()

virtual bool HydroCouple::Distributed::IExchangeRequest::test ( )
nodiscardpure virtual

Non-blocking completion test.

Returns
True if the operation has completed (successfully or not).

◆ wait()

virtual void HydroCouple::Distributed::IExchangeRequest::wait ( )
pure virtual

Blocks until the operation completes.

◆ waitFor()

virtual bool HydroCouple::Distributed::IExchangeRequest::waitFor ( double timeoutSeconds)
nodiscardpure virtual

Blocks until the operation completes or the timeout elapses.

The bounded form of wait(), for callers that must not hang on a peer that has stopped answering. A non-positive timeout tests once without blocking, exactly as test() does.

Parameters
[in]timeoutSecondsis the longest the call may block.
Returns
True if the operation has completed (successfully or not); false if it is still pending when the timeout elapses.

The documentation for this class was generated from the following file: