BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
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#if defined( _MSC_VER )
8# pragma warning( disable : 4786 ) // identifier was truncated in debug info
9#endif
10
11#ifndef MAKEDEPEND
12# include <list>
13#endif
14
15namespace XmlRpc {
16
17 // An RPC source represents a file descriptor to monitor
18 class XmlRpcSource;
19
20 //! An object which monitors file descriptors for events and performs
21 //! callbacks when interesting events happen.
23 public:
24 //! Constructor
27
28 //! Values indicating the type of events a source is interested in
29 enum EventType {
30 ReadableEvent = 1, //!< data available to read
31 WritableEvent = 2, //!< connected/data can be written without blocking
32 Exception = 4 //!< uh oh
33 };
34
35 //! Monitor this source for the event types specified by the event mask
36 //! and call its event handler when any of the events occur.
37 //! @param source The source to monitor
38 //! @param eventMask Which event types to watch for. \see EventType
39 void addSource( XmlRpcSource* source, unsigned eventMask );
40
41 //! Stop monitoring this source.
42 //! @param source The source to stop monitoring
43 void removeSource( XmlRpcSource* source );
44
45 //! Modify the types of events to watch for on this source
46 void setSourceEvents( XmlRpcSource* source, unsigned eventMask );
47
48 //! Watch current set of sources and process events for the specified
49 //! duration (in ms, -1 implies wait forever, or until exit is called)
50 void work( double msTime );
51
52 //! Exit from work routine
53 void exit();
54
55 //! Clear all sources from the monitored sources list. Sources are closed.
56 void clear();
57
58 protected:
59 // helper
60 double getTime();
61
62 // A source to monitor and what to monitor it for
64 MonitoredSource( XmlRpcSource* src, unsigned mask ) : _src( src ), _mask( mask ) {}
65 XmlRpcSource* getSource() const { return _src; }
66 unsigned& getMask() { return _mask; }
68 unsigned _mask;
69 };
70
71 // A list of sources to monitor
72 typedef std::list<MonitoredSource> SourceList;
73
74 // Sources being monitored
76
77 // When work should stop (-1 implies wait forever, or until exit is called)
78 double _endTime;
79
81 bool _inWork;
82 };
83} // namespace XmlRpc
84
85#endif // _XMLRPCDISPATCH_H_
void removeSource(XmlRpcSource *source)
EventType
Values indicating the type of events a source is interested in.
@ ReadableEvent
data available to read
@ WritableEvent
connected/data can be written without blocking
void work(double msTime)
void exit()
Exit from work routine.
std::list< MonitoredSource > SourceList
void clear()
Clear all sources from the monitored sources list. Sources are closed.
void setSourceEvents(XmlRpcSource *source, unsigned eventMask)
Modify the types of events to watch for on this source.
void addSource(XmlRpcSource *source, unsigned eventMask)
An RPC source represents a file descriptor to monitor.
MonitoredSource(XmlRpcSource *src, unsigned mask)