xrootd
XrdClPollerBuiltIn.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2011-2012 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_POLLER_BUILT_IN_HH__
20 #define __XRD_CL_POLLER_BUILT_IN_HH__
21 
22 #include "XrdSys/XrdSysPthread.hh"
23 #include "XrdCl/XrdClPoller.hh"
24 #include <map>
25 
26 namespace XrdSys { namespace IOEvents
27 {
28  class Poller;
29 }; };
30 
31 namespace XrdCl
32 {
33  //----------------------------------------------------------------------------
35  //----------------------------------------------------------------------------
36  class PollerBuiltIn: public Poller
37  {
38  public:
39  //------------------------------------------------------------------------
41  //------------------------------------------------------------------------
43 
44  //------------------------------------------------------------------------
46  //------------------------------------------------------------------------
47  virtual bool Initialize();
48 
49  //------------------------------------------------------------------------
51  //------------------------------------------------------------------------
52  virtual bool Finalize();
53 
54  //------------------------------------------------------------------------
56  //------------------------------------------------------------------------
57  virtual bool Start();
58 
59  //------------------------------------------------------------------------
61  //------------------------------------------------------------------------
62  virtual bool Stop();
63 
64  //------------------------------------------------------------------------
69  //------------------------------------------------------------------------
70  virtual bool AddSocket( Socket *socket,
71  SocketHandler *handler );
72 
73 
74  //------------------------------------------------------------------------
76  //------------------------------------------------------------------------
77  virtual bool RemoveSocket( Socket *socket );
78 
79  //------------------------------------------------------------------------
86  //------------------------------------------------------------------------
87  virtual bool EnableReadNotification( Socket *socket,
88  bool notify,
89  uint16_t timeout = 60 );
90 
91  //------------------------------------------------------------------------
98  //------------------------------------------------------------------------
99  virtual bool EnableWriteNotification( Socket *socket,
100  bool notify,
101  uint16_t timeout = 60);
102 
103  //------------------------------------------------------------------------
105  //------------------------------------------------------------------------
106  virtual bool IsRegistered( Socket *socket );
107 
108  //------------------------------------------------------------------------
110  //------------------------------------------------------------------------
111  virtual bool IsRunning() const
112  {
113  return pPoller;
114  }
115 
116  private:
117  typedef std::map<Socket *, void *> SocketMap;
121  };
122 }
123 
124 #endif // __XRD_CL_POLLER_BUILT_IN_HH__