X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FRoute.hh;h=88722c2d7cdea5de5ba823309e881c3aefe39236;hb=48bbf27e9e89d6eba4754fba65d70a15b115ac8b;hp=b09925da6720c39f161e61a98a285685a9dd8b1b;hpb=89efe5f504c400212090aba703c7ee385f483c64;p=senf.git diff --git a/PPI/Route.hh b/PPI/Route.hh index b09925d..88722c2 100644 --- a/PPI/Route.hh +++ b/PPI/Route.hh @@ -25,6 +25,8 @@ #define HH_Route_ 1 // Custom includes +#include +#include "predecl.hh" //#include "Route.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -32,21 +34,29 @@ namespace senf { namespace ppi { - template - class Route + class RouteBase + { + public: + virtual ~RouteBase(); + + protected: + RouteBase(module::Module & module); + + private: + module::Module * module_; + }; + + class ForwardingRoute + : public RouteBase { public: + bool autoThrottling() const; void autoThrottling(bool state); ///< Change automatic throttle notification forwarding /**< By default, throttle notifications are automatically forwarded from active to passive connectors. This may be disabled by setting the authoThrottling state to \c false. - This member only exists if - \li \a Source or \a Target is an event - \li one of \a Source and \a Target is an active - connector and the other is a passive connector. - Routing from/to an event to/from a passive connector will automatically create throttling notifications on the connector whenever the event is disabled. Routing @@ -54,21 +64,66 @@ namespace ppi { disable the event whenever a throttling notification comes in. Respective for unthrottle notifications. - \param[in] state New throttle forwarding state + \param[in] state New throttle forwarding state */ + + bool throttled() const; + + protected: + 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: + // 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 { +namespace ppi { + + /** \brief Route descriptor + + Route instances are created by Module::route statements. The Route class provides an + interface to manipulate the flow processing. + */ + template + class Route + : public detail::RouteImplementation + { + typedef detail::RouteImplementation Base; + private: + typedef detail::RouteImplementation Implementation; + + Route(module::Module & module, Source & source, Target & target); - \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. */ + friend class module::Module; }; }} ///////////////////////////////hh.e//////////////////////////////////////// -//#include "Route.cci" -//#include "Route.ct" -//#include "Route.cti" +#include "Route.cci" +#include "Route.ct" +#include "Route.cti" #endif @@ -78,4 +133,6 @@ namespace ppi { // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 // End: