XRootD
XrdCl::FunctionWrapper< Response > Class Template Reference

#include <XrdClOperationHandlers.hh>

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

Public Member Functions

 FunctionWrapper (std::function< void(XRootDStatus &, Response &)> handleFunction)
 Constructor. More...
 
 FunctionWrapper (std::function< void(XRootDStatus &, Response &, HostList &)> handleFunction)
 Constructor. More...
 
void HandleResponseWithHosts (XRootDStatus *status, AnyObject *response, HostList *hostList)
 Callback method. More...
 
- Public Member Functions inherited from XrdCl::ResponseHandler
virtual ~ResponseHandler ()
 
virtual void HandleResponse (XRootDStatus *status, AnyObject *response)
 

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::FunctionWrapper< Response >

Lambda wrapper

  • ResponseType : type of response returned by the server

Definition at line 146 of file XrdClOperationHandlers.hh.

Constructor & Destructor Documentation

◆ FunctionWrapper() [1/2]

template<typename Response >
XrdCl::FunctionWrapper< Response >::FunctionWrapper ( std::function< void(XRootDStatus &, Response &)>  handleFunction)
inline

Constructor.

Parameters
func: function, functor or lambda (2 arguments)

Definition at line 155 of file XrdClOperationHandlers.hh.

156  :
157  fun( [handleFunction]( XRootDStatus &s, Response &r, HostList& ){ handleFunction( s, r ); } )
158  {
159  }
std::vector< HostInfo > HostList

◆ FunctionWrapper() [2/2]

template<typename Response >
XrdCl::FunctionWrapper< Response >::FunctionWrapper ( std::function< void(XRootDStatus &, Response &, HostList &)>  handleFunction)
inline

Constructor.

Parameters
func: function, functor or lambda (3 arguments)

Definition at line 166 of file XrdClOperationHandlers.hh.

167  :
168  fun( handleFunction )
169  {
170  }

Member Function Documentation

◆ HandleResponseWithHosts()

template<typename Response >
void XrdCl::FunctionWrapper< Response >::HandleResponseWithHosts ( XRootDStatus status,
AnyObject response,
HostList hostList 
)
inlinevirtual

Callback method.

Reimplemented from XrdCl::ResponseHandler.

Definition at line 175 of file XrdClOperationHandlers.hh.

176  {
177  std::unique_ptr<XRootDStatus> delst( status );
178  std::unique_ptr<AnyObject> delrsp( response );
179  std::unique_ptr<HostList> delhl( hostList );
180  if (Response *res = GetResponse<Response>( status, response ))
181  fun( *status, *res, *hostList );
182  else {
183  Response dummy;
184  fun( *status, dummy, *hostList );
185  }
186  }

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