X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FRoute.hh;h=fb2930597f6d1f3d5a97950067d8c2c684aa5c22;hb=a1fdb7bb122f0b05be809a922d4b7ef5e125fa67;hp=ab4cc8d110b411bf0ddddf5b4976b1b82a509a89;hpb=0c6e42841266e5983ef9a9836b8f1bb98de684ba;p=senf.git diff --git a/PPI/Route.hh b/PPI/Route.hh index ab4cc8d..fb29305 100644 --- a/PPI/Route.hh +++ b/PPI/Route.hh @@ -1,6 +1,8 @@ -// Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// $Id$ +// +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -21,10 +23,12 @@ /** \file \brief Route public header */ -#ifndef HH_Route_ -#define HH_Route_ 1 +#ifndef HH_SENF_PPI_Route_ +#define HH_SENF_PPI_Route_ 1 // Custom includes +#include +#include "predecl.hh" //#include "Route.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -32,15 +36,45 @@ 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. + /** \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. */ - template - class Route + class RouteBase { public: + virtual ~RouteBase(); + +#ifdef DOXYGEN + Source & source() const; ///< Routing source + /**< \note The real implementation is in the \c + BaseRouteImplementation template in \c Route.ih. This + class is internal and not documented. */ + Target & target() const; ///< Routing target + /**< \note The real implementation is in the \c + BaseRouteImplementation template in \c Route.ih. This + class is internal and not documented. */ +#endif + + 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 @@ -54,21 +88,79 @@ 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; ///< \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: + 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. + + Depending on the type of route, one of the following classes will be a baseclass: + +
ForwardingRoute
If the route is a \e forwarding route. This is a route + which forwards throttling notifications. This is the case, if one of the route endpoints is + a notify source (a connector::ActiveConnector) and the other is a + notify target (a connector::PassiveConnector or an EventDescriptor). + +
RouteBase
If the route is not a forwarding route, it is based directly on the + generic route base class
+ */ + template + class Route + : public detail::RouteImplementation + { + private: + typedef detail::RouteImplementation Base; + 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 +170,6 @@ namespace ppi { // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 // End: