X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FRoute.hh;h=307d3418972fd950d7376276070687c791b8072a;hb=821f1bf89a0e3ef83469c56e4a9a21c39b956cb4;hp=54c41396d2499c58001259565d05103ec68a847e;hpb=81ffa1c459b96dd44472bcef37e1e373934ee138;p=senf.git diff --git a/PPI/Route.hh b/PPI/Route.hh index 54c4139..307d341 100644 --- a/PPI/Route.hh +++ b/PPI/Route.hh @@ -34,9 +34,34 @@ namespace senf { namespace ppi { + /** \brief Routing base class + + Routing information is defined within each module to define the control flow. RouteBase is + the generic base class for all routing entries. + */ class RouteBase { public: + virtual ~RouteBase(); + + protected: + RouteBase(module::Module & module); + + private: + module::Module * module_; + }; + + /** \brief Forwarding route base class + + All routes which may forward control information are based on + ForwardingRoute. ForwardingRoute provides methods to control and query the throttling + behavior. + */ + class ForwardingRoute + : public RouteBase + { + public: + bool autoThrottling() const; ///< Query current autoThrottling state void autoThrottling(bool state); ///< Change automatic throttle notification forwarding /**< By default, throttle notifications are automatically forwarded from active to passive connectors. This may @@ -50,23 +75,40 @@ namespace ppi { disable the event whenever a throttling notification comes in. Respective for unthrottle notifications. - \param[in] state New throttle forwarding state - - \implementation This class will be implemented using a - baseclass, this template and several - specializations. However, this is an implementation - detail which does not affect the exposed - interface. */ + \param[in] state New throttle forwarding state */ + bool throttled() const; ///< \c true, if the route is throttled + /**< This member checks only the automatic throttling + state. If autoThrottling() is \c false, this member + will always return \c false. */ + protected: - RouteBase(module::Module & module); + ForwardingRoute(module::Module & module); + + // Called to register this route with the connectors forwarding information base + template void registerRoute(T & ob); + + template void notifyThrottle(T & ob); + template void notifyUnthrottle(T & ob); private: - module::Module * module_; + // called to forward a throttling notification along the route + void notifyThrottle(); + void notifyUnthrottle(); + + // Implemented in the derived classes to forward throttling notifications + virtual void v_notifyThrottle() = 0; + virtual void v_notifyUnthrottle() = 0; + virtual bool v_throttled() const = 0; + + bool autoThrottling_; + + friend class connector::ActiveConnector; }; }} +// We need detail::RouteImplementation here ... #include "Route.ih" namespace senf { @@ -76,16 +118,18 @@ namespace ppi { Route instances are created by Module::route statements. The Route class provides an interface to manipulate the flow processing. + + The concrete interface provided depends on the type of route. If the route is a forwarding + route, it will be based on ForwardingRoute otherwise it will be based directly on + RouteBase. */ template class Route - : public detail::RouteImplementation< boost::is_base_of::value, - boost::is_base_of::value > + : public detail::RouteImplementation { private: - typedef detail::RouteImplementation< - boost::is_base_of::value, - boost::is_base_of::value > Implementation; + typedef detail::RouteImplementation Base; + typedef detail::RouteImplementation Implementation; Route(module::Module & module, Source & source, Target & target); @@ -96,7 +140,7 @@ namespace ppi { ///////////////////////////////hh.e//////////////////////////////////////// #include "Route.cci" -//#include "Route.ct" +#include "Route.ct" #include "Route.cti" #endif