2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
4 // Stefan Bund <g0dil@berlios.de>
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 \brief Route public header */
28 #include <boost/type_traits.hpp>
31 //#include "Route.mpp"
32 ///////////////////////////////hh.p////////////////////////////////////////
37 /** \brief Routing base class
39 Routing information is defined within each module to define the control flow. RouteBase is
40 the generic base class for all routing entries.
48 Source & source() const; ///< Routing source
49 /**< \note The real implementation is in the \c
50 BaseRouteImplementation template in \c Route.ih. This
51 class is internal and not documented. */
52 Target & target() const; ///< Routing target
53 /**< \note The real implementation is in the \c
54 BaseRouteImplementation template in \c Route.ih. This
55 class is internal and not documented. */
59 RouteBase(module::Module & module);
62 module::Module * module_;
65 /** \brief Forwarding route base class
67 All routes which may forward control information are based on
68 ForwardingRoute. ForwardingRoute provides methods to control and query the throttling
75 bool autoThrottling() const; ///< Query current autoThrottling state
76 void autoThrottling(bool state); ///< Change automatic throttle notification forwarding
77 /**< By default, throttle notifications are automatically
78 forwarded from active to passive connectors. This may
79 be disabled by setting the authoThrottling state to \c
82 Routing from/to an event to/from a passive connector
83 will automatically create throttling notifications on
84 the connector whenever the event is disabled. Routing
85 form/to an event to/from an active connector will
86 disable the event whenever a throttling notification
87 comes in. Respective for unthrottle notifications.
89 \param[in] state New throttle forwarding state */
91 bool throttled() const; ///< \c true, if the route is throttled
92 /**< This member checks only the automatic throttling
93 state. If autoThrottling() is \c false, this member
94 will always return \c false. */
97 ForwardingRoute(module::Module & module);
99 // Called to register this route with the connectors forwarding information base
100 template <class T> void registerRoute(T & ob);
102 template <class T> void notifyThrottle(T & ob);
103 template <class T> void notifyUnthrottle(T & ob);
106 // called to forward a throttling notification along the route
107 void notifyThrottle();
108 void notifyUnthrottle();
110 // Implemented in the derived classes to forward throttling notifications
111 virtual void v_notifyThrottle() = 0;
112 virtual void v_notifyUnthrottle() = 0;
113 virtual bool v_throttled() const = 0;
115 bool autoThrottling_;
117 friend class connector::ActiveConnector;
122 // We need detail::RouteImplementation here ...
128 /** \brief Route descriptor
130 Route instances are created by Module::route statements. The Route class provides an
131 interface to manipulate the flow processing.
133 Depending on the type of route, one of the following classes will be a baseclass:
135 <dl> <dt>ForwardingRoute</dt><dd>If the route is a \e forwarding route. This is a route
136 which forwards throttling notifications. This is the case, if one of the route endpoints is
137 a notify source (a connector::ActiveConnector) and the other is a
138 notify target (a connector::PassiveConnector or an EventDescriptor).
140 <dt>RouteBase</dt><dd>If the route is not a forwarding route, it is based directly on the
141 generic route base class</dd></dl>
143 template <class Source, class Target>
145 : public detail::RouteImplementation<Source,Target>
148 typedef detail::RouteImplementation<Source,Target> Base;
149 typedef detail::RouteImplementation<Source,Target> Implementation;
151 Route(module::Module & module, Source & source, Target & target);
153 friend class module::Module;
158 ///////////////////////////////hh.e////////////////////////////////////////
168 // c-file-style: "senf"
169 // indent-tabs-mode: nil
170 // ispell-local-dictionary: "american"
171 // compile-command: "scons -u test"
172 // comment-column: 40