#include <Pt/System/EventSource.h>
Sends events to sinks in other threads. More...
Inherits NonCopyable.
Public Member Functions | |
| EventSource () | |
| Default Constructor. | |
| ~EventSource () | |
| Destructor. | |
| void | send (const Pt::Event &ev) |
| Send the event to all connected sinks. | |
| void | connect (EventSink &sink) |
| Connect to an EventSink. | |
| void | disconnect (EventSink &sink) |
| Disonnect from an EventSink. | |
| template<typename EventT> | |
| void | subscribe (EventSink &sink) |
| Send events of a certain type to the sink. | |
| template<typename EventT> | |
| void | unsubscribe (EventSink &sink) |
| Do not send events of a certain type to the sink anymore. | |
Signal is not thread-safe and is for use inside one thread. EventSource sends a Event to connected EventSink objects and synchronizes connect, disconnect, and send. An EventLoop is an EventSink, so a source in one thread can queue events for a loop in another.
connect() adds a sink. disconnect() removes it. subscribe() limits a sink to one event type. unsubscribe() removes that limit. send() delivers to every connected sink that accepts the type.