OverSim
XmlRpcDispatch.h
Go to the documentation of this file.
1 
2 #ifndef _XMLRPCDISPATCH_H_
3 #define _XMLRPCDISPATCH_H_
4 //
5 // XmlRpc++ Copyright (c) 2002-2003 by Chris Morley
6 //
7 
13 #if defined(_MSC_VER)
14 # pragma warning(disable:4786) // identifier was truncated in debug info
15 #endif
16 
17 #ifndef MAKEDEPEND
18 # include <list>
19 #endif
20 
21 namespace XmlRpc {
22 
23  // An RPC source represents a file descriptor to monitor
24  class XmlRpcSource;
25 
29  public:
33 
35  enum EventType {
38  Exception = 4
39  };
40 
45  void addSource(XmlRpcSource* source, unsigned eventMask);
46 
50  void removeSource(XmlRpcSource* source);
51 
53  void setSourceEvents(XmlRpcSource* source, unsigned eventMask);
54 
55 
58  void work(double msTime);
59 
61  void exit();
62 
64  void clear();
65 
66  protected:
67 
69  bool waitForAndProcessEvents(double timeout);
70 
71 
72  // helper
73  double getTime();
74 
75  // A source to monitor and what to monitor it for
76  struct MonitoredSource {
77  MonitoredSource(XmlRpcSource* src, unsigned mask) : _src(src), _mask(mask) {}
78  XmlRpcSource* getSource() const { return _src; }
79  unsigned& getMask() { return _mask; }
81  unsigned _mask;
82  };
83 
84  // A list of sources to monitor
85  typedef std::list< MonitoredSource > SourceList;
86 
87  // Sources being monitored
89 
90  // When work should stop (-1 implies wait forever, or until exit is called)
91  double _endTime;
92 
93  bool _doClear;
94  bool _inWork;
95 
96  };
97 } // namespace XmlRpc
98 
99 #endif // _XMLRPCDISPATCH_H_