XmlRpcDispatch.h

Go to the documentation of this file.
00001 
00002 #ifndef _XMLRPCDISPATCH_H_
00003 #define _XMLRPCDISPATCH_H_
00004 //
00005 // XmlRpc++ Copyright (c) 2002-2003 by Chris Morley
00006 //
00007 
00013 #if defined(_MSC_VER)
00014 # pragma warning(disable:4786)    // identifier was truncated in debug info
00015 #endif
00016 
00017 #ifndef MAKEDEPEND
00018 # include <list>
00019 #endif
00020 
00021 namespace XmlRpc {
00022 
00023   // An RPC source represents a file descriptor to monitor
00024   class XmlRpcSource;
00025 
00028   class XmlRpcDispatch {
00029   public:
00031     XmlRpcDispatch();
00032     ~XmlRpcDispatch();
00033 
00035     enum EventType {
00036       ReadableEvent = 1,    
00037       WritableEvent = 2,    
00038       Exception     = 4     
00039     };
00040     
00045     void addSource(XmlRpcSource* source, unsigned eventMask);
00046 
00050     void removeSource(XmlRpcSource* source);
00051 
00053     void setSourceEvents(XmlRpcSource* source, unsigned eventMask);
00054 
00055 
00058     void work(double msTime);
00059 
00061     void exit();
00062 
00064     void clear();
00065 
00066   protected:
00067 
00069     bool waitForAndProcessEvents(double timeout);
00070 
00071 
00072     // helper
00073     double getTime();
00074 
00075     // A source to monitor and what to monitor it for
00076     struct MonitoredSource {
00077       MonitoredSource(XmlRpcSource* src, unsigned mask) : _src(src), _mask(mask) {}
00078       XmlRpcSource* getSource() const { return _src; }
00079       unsigned& getMask() { return _mask; }
00080       XmlRpcSource* _src;
00081       unsigned _mask;
00082     };
00083 
00084     // A list of sources to monitor
00085     typedef std::list< MonitoredSource > SourceList; 
00086 
00087     // Sources being monitored
00088     SourceList _sources;
00089 
00090     // When work should stop (-1 implies wait forever, or until exit is called)
00091     double _endTime;
00092 
00093     bool _doClear;
00094     bool _inWork;
00095 
00096   };
00097 } // namespace XmlRpc
00098 
00099 #endif  // _XMLRPCDISPATCH_H_
Generated on Wed May 26 16:21:15 2010 for OverSim by  doxygen 1.6.3