X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FEvents.hh;h=698a43320cad76090c6ab1941181265501f350fc;hb=48bbf27e9e89d6eba4754fba65d70a15b115ac8b;hp=cb21dd7c9a4c2d0884b13293c50f661ceee48afd;hpb=81ffa1c459b96dd44472bcef37e1e373934ee138;p=senf.git diff --git a/PPI/Events.hh b/PPI/Events.hh index cb21dd7..698a433 100644 --- a/PPI/Events.hh +++ b/PPI/Events.hh @@ -25,6 +25,7 @@ #define HH_Events_ 1 // Custom includes +#include #include #include "predecl.hh" @@ -64,12 +65,47 @@ namespace ppi { virtual bool v_isRegistered() = 0; + void notifyThrottle(); + void notifyUnthrottle(); + + void registerRoute(ForwardingRoute & route); + bool enabled_; + + typedef std::vector Routes; + Routes routes_; + + friend class ForwardingRoute; + }; + + template + class EventImplementationHelper + { + protected: + typedef typename detail::EventArgType::type EventArg; + + void callback(EventArg event, boost::posix_time::ptime time); + void callback(EventArg event); + + private: + detail::EventBinding & binding(); + }; + + template + class EventImplementationHelper + { + protected: + void callback(boost::posix_time::ptime time); + void callback(); + + private: + detail::EventBinding & binding(); }; template class EventImplementation - : public EventDescriptor + : public EventDescriptor, + public EventImplementationHelper< EventType, EventImplementation > { public: typedef EventType Event; @@ -78,9 +114,6 @@ namespace ppi { protected: EventImplementation(); - void callback(EventArg event, boost::posix_time::ptime time); - void callback(EventArg event); - private: virtual bool v_isRegistered(); void setBinding(detail::EventBinding & binding); @@ -88,6 +121,7 @@ namespace ppi { detail::EventBinding * binding_; friend class EventManager; + friend class EventImplementationHelper< EventType, EventImplementation >; }; }}