XRootD
XrdClResponseJob.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2013 by European Organization for Nuclear Research (CERN)
3 // Author: Lukasz Janyst <ljanyst@cern.ch>
4 //------------------------------------------------------------------------------
5 // XRootD is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // XRootD is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
17 //------------------------------------------------------------------------------
18 
19 #ifndef __XRD_CL_RESPONSE_JOB_HH__
20 #define __XRD_CL_RESPONSE_JOB_HH__
21 
22 #include "XrdCl/XrdClJobManager.hh"
24 
25 namespace XrdCl
26 {
27  //----------------------------------------------------------------------------
29  //----------------------------------------------------------------------------
30  class ResponseJob: public Job
31  {
32  public:
33  //------------------------------------------------------------------------
35  //------------------------------------------------------------------------
37  XRootDStatus *status,
38  AnyObject *response,
39  HostList *hostList ):
40  pHandler( handler ), pStatus( status ), pResponse( response ),
41  pHostList( hostList )
42  {
43  }
44 
45  //------------------------------------------------------------------------
47  //------------------------------------------------------------------------
48  virtual ~ResponseJob()
49  {
50  }
51 
52 
53  //------------------------------------------------------------------------
55  //------------------------------------------------------------------------
56  virtual void Run( void *arg )
57  {
58  pHandler->HandleResponseWithHosts( pStatus, pResponse, pHostList );
59  delete this;
60  }
61 
62  private:
63  ResponseHandler *pHandler;
64  XRootDStatus *pStatus;
65  AnyObject *pResponse;
66  HostList *pHostList;
67  };
68 }
69 
70 #endif // __XRD_CL_RESPONSE_JOB_HH__
Interface for a job to be run by the job manager.
Handle an async response.
virtual void HandleResponseWithHosts(XRootDStatus *status, AnyObject *response, HostList *hostList)
Call the user callback.
ResponseJob(ResponseHandler *handler, XRootDStatus *status, AnyObject *response, HostList *hostList)
Constructor.
virtual void Run(void *arg)
Run the user handler.
virtual ~ResponseJob()
Destructor.
std::vector< HostInfo > HostList