4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief Route public header */
30 #include <boost/type_traits.hpp>
33 //#include "Route.mpp"
34 ///////////////////////////////hh.p////////////////////////////////////////
39 /** \brief Routing base class
41 Routing information is defined within each module to define the control flow. RouteBase is
42 the generic base class for all routing entries.
50 Source & source() const; ///< Routing source
51 /**< \note The real implementation is in the \c
52 BaseRouteImplementation template in \c Route.ih. This
53 class is internal and not documented. */
54 Target & target() const; ///< Routing target
55 /**< \note The real implementation is in the \c
56 BaseRouteImplementation template in \c Route.ih. This
57 class is internal and not documented. */
61 RouteBase(module::Module & module);
64 module::Module * module_;
67 /** \brief Forwarding route base class
69 All routes which may forward control information are based on
70 ForwardingRoute. ForwardingRoute provides methods to control and query the throttling
77 bool autoThrottling() const; ///< Query current autoThrottling state
78 void autoThrottling(bool state); ///< Change automatic throttle notification forwarding
79 /**< By default, throttle notifications are automatically
80 forwarded from active to passive connectors. This may
81 be disabled by setting the authoThrottling state to \c
84 Routing from/to an event to/from a passive connector
85 will automatically create throttling notifications on
86 the connector whenever the event is disabled. Routing
87 form/to an event to/from an active connector will
88 disable the event whenever a throttling notification
89 comes in. Respective for unthrottle notifications.
91 \param[in] state New throttle forwarding state */
93 bool throttled() const; ///< \c true, if the route is throttled
94 /**< This member checks only the automatic throttling
95 state. If autoThrottling() is \c false, this member
96 will always return \c false. */
99 ForwardingRoute(module::Module & module);
101 // Called to register this route with the connectors forwarding information base
102 template <class T> void registerRoute(T & ob);
104 template <class T> void notifyThrottle(T & ob);
105 template <class T> void notifyUnthrottle(T & ob);
108 // called to forward a throttling notification along the route
109 void notifyThrottle();
110 void notifyUnthrottle();
112 // Implemented in the derived classes to forward throttling notifications
113 virtual void v_notifyThrottle() = 0;
114 virtual void v_notifyUnthrottle() = 0;
115 virtual bool v_throttled() const = 0;
117 bool autoThrottling_;
119 friend class connector::ActiveConnector;
124 // We need detail::RouteImplementation here ...
130 /** \brief Route descriptor
132 Route instances are created by Module::route statements. The Route class provides an
133 interface to manipulate the flow processing.
135 Depending on the type of route, one of the following classes will be a baseclass:
137 <dl> <dt>ForwardingRoute</dt><dd>If the route is a \e forwarding route. This is a route
138 which forwards throttling notifications. This is the case, if one of the route endpoints is
139 a notify source (a connector::ActiveConnector) and the other is a
140 notify target (a connector::PassiveConnector or an EventDescriptor).
142 <dt>RouteBase</dt><dd>If the route is not a forwarding route, it is based directly on the
143 generic route base class</dd></dl>
145 template <class Source, class Target>
147 : public detail::RouteImplementation<Source,Target>
150 typedef detail::RouteImplementation<Source,Target> Base;
151 typedef detail::RouteImplementation<Source,Target> Implementation;
153 Route(module::Module & module, Source & source, Target & target);
155 friend class module::Module;
160 ///////////////////////////////hh.e////////////////////////////////////////
170 // c-file-style: "senf"
171 // indent-tabs-mode: nil
172 // ispell-local-dictionary: "american"
173 // compile-command: "scons -u test"
174 // comment-column: 40