removed some useless spaces; not very important, I know :)
[senf.git] / PPI / Route.hh
index e3eee1c..fa59c96 100644 (file)
@@ -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 <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
 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();
 
+#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);
 
@@ -46,11 +64,17 @@ namespace ppi {
         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();
+        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
@@ -65,12 +89,20 @@ namespace ppi {
                                              comes in. Respective for unthrottle notifications.
 
                                              \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
-        void registerRoute(connector::ActiveConnector & connector);
+        template <class T> void registerRoute(T & ob);
+
+        template <class T> void notifyThrottle(T & ob);
+        template <class T> void notifyUnthrottle(T & ob);
 
     private:
         // called to forward a throttling notification along the route
@@ -80,6 +112,7 @@ namespace ppi {
         // 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_;
 
@@ -98,12 +131,23 @@ namespace ppi {
         
         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:
+
+        <dl> <dt>ForwardingRoute</dt><dd>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).
+
+        <dt>RouteBase</dt><dd>If the route is not a forwarding route, it is based directly on the
+        generic route base class</dd></dl>
      */
     template <class Source, class Target>
     class Route
         : public detail::RouteImplementation<Source,Target>
     {
     private:
+        typedef detail::RouteImplementation<Source,Target> Base;
         typedef detail::RouteImplementation<Source,Target> Implementation;
         
         Route(module::Module & module, Source & source, Target & target);
@@ -115,7 +159,7 @@ namespace ppi {
 
 ///////////////////////////////hh.e////////////////////////////////////////
 #include "Route.cci"
-//#include "Route.ct"
+#include "Route.ct"
 #include "Route.cti"
 #endif