30 #ifndef PT_SYSTEM_EVENTSOURCE_H
31 #define PT_SYSTEM_EVENTSOURCE_H
33 #include <Pt/System/Api.h>
34 #include <Pt/System/Mutex.h>
35 #include <Pt/System/EventSink.h>
37 #include <Pt/Signal.h>
81 template <
typename EventT>
84 subscribe( sink,
typeid(EventT) );
89 template <
typename EventT>
92 unsubscribe( sink,
typeid(EventT) );
100 void subscribe(
EventSink& sink,
const std::type_info& ti);
103 void unsubscribe(
EventSink& sink,
const std::type_info& ti);
108 typedef std::multimap<
const std::type_info*,
110 CompareEventTypeInfo > SinkMap;
114 mutable SinkMap _sinks;
115 mutable Sentry* _sentry;
123 #endif // PT_SYSTEM_EVENTSOURCE_H
void subscribe(EventSink &sink)
Send events of a certain type to the sink.
Definition: EventSource.h:82
Protects derived classes from being copied.
Definition: NonCopyable.h:54
Recursive mutual exclusion device.
Definition: Mutex.h:187
Receiver for events.
Definition: EventSink.h:45
Base class for all event types.
Definition: Event.h:49
Sends Events to receivers in other threads.
Definition: EventSource.h:54
void unsubscribe(EventSink &sink)
Do not send events of a certain type to the sink anymore.
Definition: EventSource.h:90