XRootD
Loading...
Searching...
No Matches
XrdCl::FutureWrapper< Response > Class Template Reference

#include <XrdClOperationHandlers.hh>

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

Public Member Functions

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

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)
 
- Protected Member Functions inherited from XrdCl::FutureWrapperBase< Response >
void SetException (const XRootDStatus &err)
 
- Protected Attributes inherited from XrdCl::FutureWrapperBase< Response >
bool fulfilled
 
std::promise< Response > prms
 promise that corresponds to the future
 

Detailed Description

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

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

  • Response : response type

Definition at line 503 of file XrdClOperationHandlers.hh.

Constructor & Destructor Documentation

◆ FutureWrapper()

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

Constructor,

See also
FutureWrapperBase
Parameters
ftr: the future to be linked with this handler

Definition at line 512 of file XrdClOperationHandlers.hh.

512 : FutureWrapperBase<Response>( ftr )
513 {
514 }

Member Function Documentation

◆ HandleResponse()

template<typename Response >
void XrdCl::FutureWrapper< Response >::HandleResponse ( XRootDStatus status,
AnyObject response 
)
inlinevirtual

Callback method.

Reimplemented from XrdCl::ResponseHandler.

Definition at line 519 of file XrdClOperationHandlers.hh.

520 {
521 std::unique_ptr<XRootDStatus> delst( status );
522 std::unique_ptr<AnyObject> delrsp( response );
523 if( status->IsOK() )
524 {
525 Response *resp = GetResponse<Response>( response );
526 if( resp == &NullRef<Response>::value )
527 this->SetException( XRootDStatus( stError, errInternal ) );
528 else
529 {
530 this->prms.set_value( std::move( *resp ) );
531 this->fulfilled = true;
532 }
533 }
534 else
535 this->SetException( *status );
536 }
void SetException(const XRootDStatus &err)
std::promise< Response > prms
promise that corresponds to the future
const uint16_t stError
An error occurred that could potentially be retried.
const uint16_t errInternal
Internal error.

References XrdCl::errInternal, XrdCl::FutureWrapperBase< Response >::fulfilled, XrdCl::Status::IsOK(), XrdCl::FutureWrapperBase< Response >::prms, XrdCl::FutureWrapperBase< Response >::SetException(), and XrdCl::stError.

+ Here is the call graph for this function:

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