X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPPI%2FEvents.hh;h=55a0e94e05ca19e6ca39b4846ab8dcb73c18efa6;hb=c505c034e5fdc932c02aa3dc3847a5551011d87e;hp=8e922cdce67649f8f652788648e4d01815d289dd;hpb=26610f603ebdd465307b9621f532c1fe19fd5571;p=senf.git diff --git a/senf/PPI/Events.hh b/senf/PPI/Events.hh index 8e922cd..55a0e94 100644 --- a/senf/PPI/Events.hh +++ b/senf/PPI/Events.hh @@ -36,7 +36,9 @@ namespace senf { namespace ppi { - + + namespace detail { class EventBindingBase; } + /** \defgroup event_group Events Events provide notification of events outside the PPI framework: I/O activity, Timers @@ -47,13 +49,13 @@ namespace ppi { All events are derived from EventImplementation which is based on EventDescriptor. \see EventImplementation \n - \ref ppi_events + \ref ppi_events */ // Implementation: The concrete EventDescriptor implementation will need to set things up so // some callback (within the EventDescriptor implementation) will be called when the event // happens. This setup happens in 'v_enable()'. This internal handler sets up an EventType - // instance if needed and calls 'callback()'. + // instance if needed and calls 'callback()'. // // 'callback()' will access the EventBinding wrapper to find the user-callback to signal. It // will do any needed internal processing, call that user callback and clean up afterwards. @@ -63,7 +65,7 @@ namespace ppi { The EventDescriptor base-class provides an interface to control events. \see \ref ppi_events - */ + */ class EventDescriptor { public: @@ -85,6 +87,7 @@ namespace ppi { void notifyUnthrottle(); void registerRoute(ForwardingRoute & route); + void unregisterRoute(ForwardingRoute & route); bool enabled_; bool throttled_; @@ -92,9 +95,12 @@ namespace ppi { typedef std::vector Routes; Routes routes_; + detail::EventBindingBase * binding_; + friend class ForwardingRoute; + friend class detail::EventBindingBase; }; - + /** \brief Internal: Callback forwarders */ template @@ -115,7 +121,7 @@ namespace ppi { private: detail::EventBinding & binding(); }; - + #ifndef DOXYGEN template @@ -133,7 +139,7 @@ namespace ppi { /** \brief Event implementation base class - EventImplementation provides the base-class for all Event implementations. + EventImplementation provides the base-class for all Event implementations. \code class SomeEvent : public EventImplementation { @@ -151,7 +157,7 @@ namespace ppi { void cb() { // Build event argument - SomeEventArg arg (...); + SomeEventArg arg (...); // Call the event callback callback(arg); } @@ -170,7 +176,7 @@ namespace ppi { */ template class EventImplementation - : public EventDescriptor, + : public EventDescriptor, public EventImplementationHelper< EventType, EventImplementation > { public: @@ -179,7 +185,7 @@ namespace ppi { module::Module & module() const; ///< Module in which the event is registered EventManager & manager() const; ///< EventManager of the event - + protected: EventImplementation();