X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPPI%2FEvents.hh;h=73de626652bb03ffd8c038b2de86c7fc6282d69d;hb=7ee689fe38d66aa3a0004d55e8708750d35adc0b;hp=8e922cdce67649f8f652788648e4d01815d289dd;hpb=26610f603ebdd465307b9621f532c1fe19fd5571;p=senf.git diff --git a/senf/PPI/Events.hh b/senf/PPI/Events.hh index 8e922cd..73de626 100644 --- a/senf/PPI/Events.hh +++ b/senf/PPI/Events.hh @@ -32,11 +32,13 @@ #include "predecl.hh" //#include "Events.mpp" -///////////////////////////////hh.p//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// 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,13 +65,13 @@ namespace ppi { The EventDescriptor base-class provides an interface to control events. \see \ref ppi_events - */ + */ class EventDescriptor { public: virtual ~EventDescriptor(); - bool enabled(); ///< Check, whether the event is currently enabled + bool enabled() const; ///< Check, whether the event is currently enabled void enabled(bool v); ///< Enable or disable the event protected: @@ -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(); @@ -195,7 +201,7 @@ namespace ppi { }} -///////////////////////////////hh.e//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// #include "Events.cci" //#include "Events.ct" #include "Events.cti"