1 #ifndef MSP_IO_EVENTOBJECT_H_
2 #define MSP_IO_EVENTOBJECT_H_
12 Interface class for objects that can provide event-based I/O. These objects
13 can be fed to the various poll functions in poll.h, or added to an
14 EventDispatcher to generate event signals.
16 class EventObject: public Base
19 /** Emitted when there is data available for reading. If all data is not
20 read, the signal is emitted again immediately. */
21 sigc::signal<void> signal_data_available;
23 /** Emitted when the mask of interesting events changes. Mainly for use by
25 sigc::signal<void, PollEvent> signal_events_changed;
28 PollEvent _events = P_NONE;
32 virtual ~EventObject();
34 void set_events(PollEvent);
36 /** Returns a mask of the currently interesting events. Used by
38 PollEvent get_events() const { return _events; }
40 /** Returns a handle for polling. */
41 virtual const Handle &get_event_handle() = 0;
43 /** Notifies the object of an event. Used by EventDispatcher. */
44 void event(PollEvent);
47 /** Called when an event occurs. Derived classes can implement this to
49 virtual void on_event(PollEvent) { }