00001 00002 #ifndef _XMLRPCDISPATCH_H_ 00003 #define _XMLRPCDISPATCH_H_ 00004 // 00005 // XmlRpc++ Copyright (c) 2002-2003 by Chris Morley 00006 // 00007 #if defined(_MSC_VER) 00008 # pragma warning(disable:4786) // identifier was truncated in debug info 00009 #endif 00010 00011 #ifndef MAKEDEPEND 00012 # include <list> 00013 #endif 00014 00015 namespace XmlRpc { 00016 00017 // An RPC source represents a file descriptor to monitor 00018 class XmlRpcSource; 00019 00022 class XmlRpcDispatch { 00023 public: 00025 XmlRpcDispatch(); 00026 ~XmlRpcDispatch(); 00027 00029 enum EventType { 00030 ReadableEvent = 1, 00031 WritableEvent = 2, 00032 Exception = 4 00033 }; 00034 00039 void addSource(XmlRpcSource* source, unsigned eventMask); 00040 00043 void removeSource(XmlRpcSource* source); 00044 00046 void setSourceEvents(XmlRpcSource* source, unsigned eventMask); 00047 00048 00051 void work(double msTime); 00052 00054 void exit(); 00055 00057 void clear(); 00058 00059 protected: 00060 00061 // helper 00062 double getTime(); 00063 00064 // A source to monitor and what to monitor it for 00065 struct MonitoredSource { 00066 MonitoredSource(XmlRpcSource* src, unsigned mask) : _src(src), _mask(mask) {} 00067 XmlRpcSource* getSource() const { return _src; } 00068 unsigned& getMask() { return _mask; } 00069 XmlRpcSource* _src; 00070 unsigned _mask; 00071 }; 00072 00073 // A list of sources to monitor 00074 typedef std::list< MonitoredSource > SourceList; 00075 00076 // Sources being monitored 00077 SourceList _sources; 00078 00079 // When work should stop (-1 implies wait forever, or until exit is called) 00080 double _endTime; 00081 00082 bool _doClear; 00083 bool _inWork; 00084 00085 }; 00086 } // namespace XmlRpc 00087 00088 #endif // _XMLRPCDISPATCH_H_