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;
33 void set_events(PollEvent);
35 /** Returns a mask of the currently interesting events. Used by
37 PollEvent get_events() const { return events; }
39 /** Returns a handle for polling. */
40 virtual const Handle &get_event_handle() = 0;
42 /** Notifies the object of an event. Used by EventDispatcher. */
43 void event(PollEvent);
46 /** Called when an event occurs. Derived classes can implement this to
48 virtual void on_event(PollEvent) { }