26 #ifndef __XRD_CL_OPERATION_HANDLERS_HH__ 27 #define __XRD_CL_OPERATION_HANDLERS_HH__ 39 template<
typename Hdlr>
46 static constexpr
bool value = std::is_base_of<XrdCl::ResponseHandler, Hdlr>::value;
55 template<
typename Hdlr>
62 static constexpr
bool value = std::is_base_of<XrdCl::ResponseHandler, Hdlr>::value;
98 std::function<void( XRootDStatus& )>
fun;
106 template<
typename ResponseType>
117 std::function<
void(
XRootDStatus&, ResponseType& )> handleFunction ) :
118 fun( handleFunction )
127 ResponseType *res =
nullptr;
129 response->
Get( res );
132 fun( *status, *res );
142 std::function<void( XRootDStatus&, ResponseType& )>
fun;
153 template<
typename ResponseType>
163 template<
typename Response,
typename Return>
183 Response *resp =
nullptr;
185 response->
Get( resp );
188 task( *status, *resp );
199 std::packaged_task<Return( XRootDStatus&, Response& )>
task;
210 template<
typename Response,
typename Return>
220 template<
typename Return>
251 std::packaged_task<Return( XRootDStatus& )>
task;
269 f(
f ),
fun( handleFunction )
283 fun( *status, *info );
284 if( info != &
nullref )
delete info;
295 std::function<void( XRootDStatus&, StatInfo& )>
fun;
343 const char*
what() const noexcept
369 template<
typename Response>
382 ftr =
prms.get_future();
406 prms.set_exception( ex );
426 template<
typename Response>
451 response->
Get( resp );
452 this->
prms.set_value( std::move( *resp ) );
509 template<
typename Response>
552 template<
typename Response>
573 template<
typename Return>
611 template<
typename Return>
624 #endif // __XRD_CL_OPERATIONS_HANDLERS_HH__ void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:238
static ResponseType nullref
Null reference to the response (not really but acts as one)
Definition: XrdClOperationHandlers.hh:147
TaskWrapper(std::packaged_task< Return(XRootDStatus &, Response &)> &&task)
Constructor.
Definition: XrdClOperationHandlers.hh:173
Definition: XrdClAnyObject.hh:32
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:125
static ResponseHandler * Create(ResponseHandler &hdlr)
Definition: XrdClOperationHandlers.hh:529
File & f
Definition: XrdClOperationHandlers.hh:291
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:86
static Response nullref
Null reference to the response (not really but acts as one)
Definition: XrdClOperationHandlers.hh:204
const char * what() const noexcept
inherited from std::exception
Definition: XrdClOperationHandlers.hh:343
void Get(Type &object)
Retrieve the object being held.
Definition: XrdClAnyObject.hh:78
std::string ToString() const
Create a string representation.
Definition: XrdClOperationHandlers.hh:40
Object stat info.
Definition: XrdClXRootDResponses.hh:332
Definition: XrdClOperationHandlers.hh:370
static ResponseHandler * Create(std::future< Response > &ftr)
Definition: XrdClOperationHandlers.hh:540
std::promise< Response > prms
promise that corresponds to the future
Definition: XrdClOperationHandlers.hh:412
std::function< void(XRootDStatus &, StatInfo &)> fun
user defined function, functor or lambda
Definition: XrdClOperationHandlers.hh:295
static ResponseHandler * Create(std::packaged_task< Return(XRootDStatus &, Response &)> &task)
Definition: XrdClOperationHandlers.hh:574
SimpleFunctionWrapper(std::function< void(XRootDStatus &)> handleFunction)
Constructor.
Definition: XrdClOperationHandlers.hh:77
bool IsOK() const
We're fine.
Definition: XrdClStatus.hh:119
PipelineException(const PipelineException &ex)
Copy constructor.
Definition: XrdClOperationHandlers.hh:326
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:181
Definition: XrdClOperationHandlers.hh:164
Definition: XrdClOperationHandlers.hh:553
Definition: XrdClOperationHandlers.hh:221
TaskWrapper(std::packaged_task< Return(XRootDStatus &)> &&task)
Constructor.
Definition: XrdClOperationHandlers.hh:230
FutureWrapper(std::future< Response > &ftr)
Definition: XrdClOperationHandlers.hh:436
void SetException(const XRootDStatus &err)
Definition: XrdClOperationHandlers.hh:403
Pipeline exception, wrapps an XRootDStatus.
Definition: XrdClOperationHandlers.hh:311
A file.
Definition: XrdClFile.hh:44
Definition: XrdClOperationHandlers.hh:427
const uint16_t stError
An error occurred that could potentially be retried.
Definition: XrdClStatus.hh:32
PipelineException & operator=(const PipelineException &ex)
Assigment operator.
Definition: XrdClOperationHandlers.hh:334
Request status.
Definition: XrdClXRootDResponses.hh:212
Definition: XrdClAnyObject.hh:25
static ResponseHandler * Create(std::function< void(XRootDStatus &, Response &)> func)
Definition: XrdClOperationHandlers.hh:561
std::packaged_task< Return(XRootDStatus &, Response &)> task
user defined task
Definition: XrdClOperationHandlers.hh:199
const uint16_t errPipelineFailed
Pipeline failed and operation couldn't be executed.
Definition: XrdClStatus.hh:65
std::function< void(XRootDStatus &, ResponseType &)> fun
user defined function, functor or lambda
Definition: XrdClOperationHandlers.hh:142
std::packaged_task< Return(XRootDStatus &)> task
user defined task
Definition: XrdClOperationHandlers.hh:251
const XRootDStatus & GetError() const
Definition: XrdClOperationHandlers.hh:351
Definition: XrdClOperationHandlers.hh:510
Lambda wrapper.
Definition: XrdClOperationHandlers.hh:258
static ResponseHandler * Create(std::packaged_task< Return(XRootDStatus &)> &task)
Definition: XrdClOperationHandlers.hh:612
ExOpenFuncWrapper(File &f, std::function< void(XRootDStatus &, StatInfo &)> handleFunction)
Constructor.
Definition: XrdClOperationHandlers.hh:267
Handle an async response.
Definition: XrdClXRootDResponses.hh:854
static constexpr bool value
Definition: XrdClOperationHandlers.hh:46
XRootDStatus Stat(bool force, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
static StatInfo nullref
Null reference to the response (not really but acts as one)
Definition: XrdClOperationHandlers.hh:300
FunctionWrapper(std::function< void(XRootDStatus &, ResponseType &)> handleFunction)
Constructor.
Definition: XrdClOperationHandlers.hh:116
static ResponseHandler * Create(ResponseHandler *hdlr)
Definition: XrdClOperationHandlers.hh:518
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:484
XRootDStatus error
the XRootDStatus associated with this exception
Definition: XrdClOperationHandlers.hh:361
bool called
true if the handler has been called, false otherwise
Definition: XrdClOperationHandlers.hh:417
std::function< void(XRootDStatus &)> fun
user defined function, functor or lambda
Definition: XrdClOperationHandlers.hh:98
FutureWrapperBase(std::future< Response > &ftr)
Definition: XrdClOperationHandlers.hh:380
Definition: XrdClOperationHandlers.hh:107
~FutureWrapperBase()
Definition: XrdClOperationHandlers.hh:390
PipelineException(const XRootDStatus &error)
Constructor from XRootDStatus.
Definition: XrdClOperationHandlers.hh:318
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:276
Lambda wrapper.
Definition: XrdClOperationHandlers.hh:68
FutureWrapper(std::future< void > &ftr)
Definition: XrdClOperationHandlers.hh:476
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:444
static ResponseHandler * Create(std::function< void(XRootDStatus &)> func)
Definition: XrdClOperationHandlers.hh:600