$search
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 #include "XmlRpcDecl.h" 00012 00013 #ifndef MAKEDEPEND 00014 # include <list> 00015 #endif 00016 00017 namespace XmlRpc { 00018 00019 // An RPC source represents a file descriptor to monitor 00020 class XmlRpcSource; 00021 00024 class XMLRPCPP_DECL XmlRpcDispatch { 00025 public: 00027 XmlRpcDispatch(); 00028 ~XmlRpcDispatch(); 00029 00031 enum EventType { 00032 ReadableEvent = 1, 00033 WritableEvent = 2, 00034 Exception = 4 00035 }; 00036 00041 void addSource(XmlRpcSource* source, unsigned eventMask); 00042 00045 void removeSource(XmlRpcSource* source); 00046 00048 void setSourceEvents(XmlRpcSource* source, unsigned eventMask); 00049 00050 00053 void work(double msTime); 00054 00056 void exit(); 00057 00059 void clear(); 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 protected: 00079 00080 // When work should stop (-1 implies wait forever, or until exit is called) 00081 double _endTime; 00082 00083 bool _doClear; 00084 bool _inWork; 00085 00086 }; 00087 } // namespace XmlRpc 00088 00089 #endif // _XMLRPCDISPATCH_H_