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 */
26 #ifndef HH_SENF_PPI_Route_
27 #define HH_SENF_PPI_Route_ 1
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. */
60 bool hasConnector(connector::Connector const & conn) const;
61 ///< \c true, if route has connector \a conn
62 bool hasEvent(EventDescriptor const & event) const;
63 ///< \c true, if route has event \a event
66 RouteBase(module::Module & module);
69 virtual bool v_hasConnector(connector::Connector const & conn) const = 0;
70 virtual bool v_hasEvent(EventDescriptor const & event) const = 0;
72 module::Module * module_;
75 /** \brief Forwarding route base class
77 All routes which may forward control information are based on
78 ForwardingRoute. ForwardingRoute provides methods to control and query the throttling
85 bool autoThrottling() const; ///< Query current autoThrottling state
86 void autoThrottling(bool state); ///< Change automatic throttle notification forwarding
87 /**< By default, throttle notifications are automatically
88 forwarded from active to passive connectors. This may
89 be disabled by setting the authoThrottling state to \c
92 Routing from/to an event to/from a passive connector
93 will automatically create throttling notifications on
94 the connector whenever the event is disabled. Routing
95 form/to an event to/from an active connector will
96 disable the event whenever a throttling notification
97 comes in. Respective for unthrottle notifications.
99 \param[in] state New throttle forwarding state */
101 bool throttled() const; ///< \c true, if the route is throttled
102 /**< This member checks only the automatic throttling
103 state. If autoThrottling() is \c false, this member
104 will always return \c false. */
107 ForwardingRoute(module::Module & module);
109 // Called to register this route with the connectors forwarding information base
110 template <class T> void registerRoute(T & ob);
111 template <class T> void unregisterRoute(T & ob);
113 template <class T> void notifyThrottle(T & ob);
114 template <class T> void notifyUnthrottle(T & ob);
117 // called to forward a throttling notification along the route
118 void notifyThrottle();
119 void notifyUnthrottle();
121 // Implemented in the derived classes to forward throttling notifications
122 virtual void v_notifyThrottle() = 0;
123 virtual void v_notifyUnthrottle() = 0;
124 virtual bool v_throttled() const = 0;
126 bool autoThrottling_;
128 friend class connector::ActiveConnector;
133 // We need detail::RouteImplementation here ...
139 /** \brief Route descriptor
141 Route instances are created by Module::route statements. The Route class provides an
142 interface to manipulate the flow processing.
144 Depending on the type of route, one of the following classes will be a baseclass:
146 <dl> <dt>ForwardingRoute</dt><dd>If the route is a \e forwarding route. This is a route
147 which forwards throttling notifications. This is the case, if one of the route endpoints is
148 a notify source (a connector::ActiveConnector) and the other is a
149 notify target (a connector::PassiveConnector or an EventDescriptor).
151 <dt>RouteBase</dt><dd>If the route is not a forwarding route, it is based directly on the
152 generic route base class</dd></dl>
154 template <class Source, class Target>
156 : public detail::RouteImplementation<Source,Target>
159 typedef detail::RouteImplementation<Source,Target> Base;
160 typedef detail::RouteImplementation<Source,Target> Implementation;
162 Route(module::Module & module, Source & source, Target & target);
164 friend class module::Module;
169 ///////////////////////////////hh.e////////////////////////////////////////
179 // c-file-style: "senf"
180 // indent-tabs-mode: nil
181 // ispell-local-dictionary: "american"
182 // compile-command: "scons -u test"
183 // comment-column: 40