XRootD
XrdCl::FutureWrapperBase< Response > Class Template Reference

#include <XrdClOperationHandlers.hh>

+ Inheritance diagram for XrdCl::FutureWrapperBase< Response >:
+ Collaboration diagram for XrdCl::FutureWrapperBase< Response >:

Public Member Functions

 FutureWrapperBase (std::future< Response > &ftr)
 
virtual ~FutureWrapperBase ()
 Destructor. More...
 
- Public Member Functions inherited from XrdCl::ResponseHandler
virtual ~ResponseHandler ()
 
virtual void HandleResponse (XRootDStatus *status, AnyObject *response)
 
virtual void HandleResponseWithHosts (XRootDStatus *status, AnyObject *response, HostList *hostList)
 

Protected Member Functions

void SetException (const XRootDStatus &err)
 

Protected Attributes

bool fulfilled
 
std::promise< Response > prms
 promise that corresponds to the future More...
 

Additional Inherited Members

- Static Public Member Functions inherited from XrdCl::ResponseHandler
static ResponseHandlerWrap (std::function< void(XRootDStatus &, AnyObject &)> func)
 
static ResponseHandlerWrap (std::function< void(XRootDStatus *, AnyObject *)> func)
 

Detailed Description

template<typename Response>
class XrdCl::FutureWrapperBase< Response >

A wrapper handler for a std::promise / std::future.

  • Response : response type

Definition at line 453 of file XrdClOperationHandlers.hh.

Constructor & Destructor Documentation

◆ FutureWrapperBase()

template<typename Response >
XrdCl::FutureWrapperBase< Response >::FutureWrapperBase ( std::future< Response > &  ftr)
inline

Constructor, initializes the std::future argument from its own std::promise

Parameters
ftr: the future to be linked with this handler

Definition at line 463 of file XrdClOperationHandlers.hh.

463  : fulfilled( false )
464  {
465  ftr = prms.get_future();
466  }
std::promise< Response > prms
promise that corresponds to the future

References XrdCl::FutureWrapperBase< Response >::prms.

◆ ~FutureWrapperBase()

template<typename Response >
virtual XrdCl::FutureWrapperBase< Response >::~FutureWrapperBase ( )
inlinevirtual

Destructor.

Definition at line 471 of file XrdClOperationHandlers.hh.

472  {
473  if( !fulfilled ) SetException( XRootDStatus( stError, errPipelineFailed ) );
474  }
void SetException(const XRootDStatus &err)
const uint16_t stError
An error occurred that could potentially be retried.
Definition: XrdClStatus.hh:32
const uint16_t errPipelineFailed
Pipeline failed and operation couldn't be executed.
Definition: XrdClStatus.hh:66

References XrdCl::errPipelineFailed, XrdCl::FutureWrapperBase< Response >::fulfilled, XrdCl::FutureWrapperBase< Response >::SetException(), and XrdCl::stError.

+ Here is the call graph for this function:

Member Function Documentation

◆ SetException()

template<typename Response >
void XrdCl::FutureWrapperBase< Response >::SetException ( const XRootDStatus err)
inlineprotected

Set exception in the std::promise / std::future

Parameters
err: the error

Definition at line 483 of file XrdClOperationHandlers.hh.

484  {
485  std::exception_ptr ex = std::make_exception_ptr( PipelineException( err ) );
486  prms.set_exception( ex );
487  fulfilled = true;
488  }

References XrdCl::FutureWrapperBase< Response >::fulfilled, and XrdCl::FutureWrapperBase< Response >::prms.

Referenced by XrdCl::FutureWrapperBase< Response >::~FutureWrapperBase(), XrdCl::FutureWrapper< Response >::HandleResponse(), and XrdCl::FutureWrapper< void >::HandleResponse().

+ Here is the caller graph for this function:

Member Data Documentation

◆ fulfilled

◆ prms

template<typename Response >
std::promise<Response> XrdCl::FutureWrapperBase< Response >::prms
protected

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