4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
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 inline non-template implementation */
27 #include "Connectors.hh"
30 #define prefix_ inline
31 ///////////////////////////////cci.p///////////////////////////////////////
33 ///////////////////////////////////////////////////////////////////////////
34 // senf::ppi::RouteBase
36 prefix_ senf::ppi::RouteBase::~RouteBase()
39 ////////////////////////////////////////
42 prefix_ senf::ppi::RouteBase::RouteBase(module::Module & module)
46 ///////////////////////////////////////////////////////////////////////////
47 // senf::ppi::ForwardingRoute
49 prefix_ bool senf::ppi::ForwardingRoute::autoThrottling()
51 return autoThrottling_;
54 prefix_ void senf::ppi::ForwardingRoute::autoThrottling(bool state)
56 autoThrottling_ = state;
59 ////////////////////////////////////////
62 prefix_ senf::ppi::ForwardingRoute::ForwardingRoute(module::Module & module)
63 : RouteBase(module), autoThrottling_(false)
66 prefix_ void senf::ppi::ForwardingRoute::registerRoute(connector::ActiveConnector & connector)
68 connector.registerRoute(*this);
71 ////////////////////////////////////////
74 prefix_ void senf::ppi::ForwardingRoute::notifyThrottle()
79 prefix_ void senf::ppi::ForwardingRoute::notifyUnthrottle()
84 ///////////////////////////////////////////////////////////////////////////
85 // senf::ppi::detail::NonForwardingRouteImplementation
87 prefix_ senf::ppi::detail::NonForwardingRouteImplementation::
88 NonForwardingRouteImplementation(module::Module & module, connector::InputConnector & source,
89 connector::OutputConnector & target)
90 : RouteBase(module), source_(&source), target_(&target)
93 ///////////////////////////////////////////////////////////////////////////
94 // senf::ppi::detail::NonForwardingRouteToEventImplementation
97 senf::ppi::detail::NonForwardingRouteToEventImplementation::
98 NonForwardingRouteToEventImplementation(module::Module & module,
99 connector::InputConnector & source,
100 EventDescriptor & target)
101 : RouteBase(module), source_(&source), target_(&target)
104 ///////////////////////////////////////////////////////////////////////////
105 // senf::ppi::detail::NonForwardingRouteFromEventImplementation
108 senf::ppi::detail::NonForwardingRouteFromEventImplementation::
109 NonForwardingRouteFromEventImplementation(module::Module & module, EventDescriptor & source,
110 connector::OutputConnector & target)
111 : RouteBase(module), source_(&source), target_(&target)
114 ///////////////////////////////////////////////////////////////////////////
115 // senf::ppi::detail::ForwardForwardingRouteImplementation
118 senf::ppi::detail::ForwardForwardingRouteImplementation::
119 ForwardForwardingRouteImplementation(module::Module & module, connector::ActiveInput & source,
120 connector::PassiveOutput & target)
121 : ForwardingRoute(module), source_(&source), target_(&target)
123 registerRoute(*source_);
126 prefix_ void senf::ppi::detail::ForwardForwardingRouteImplementation::v_notifyThrottle()
128 if (autoThrottling())
129 target_->notifyThrottle();
132 prefix_ void senf::ppi::detail::ForwardForwardingRouteImplementation::v_notifyUnthrottle()
134 if (autoThrottling())
135 target_->notifyUnthrottle();
138 ///////////////////////////////////////////////////////////////////////////
139 // senf::ppi::detail::BackwardForwardingRouteImplementation
142 senf::ppi::detail::BackwardForwardingRouteImplementation::
143 BackwardForwardingRouteImplementation(module::Module & module,
144 connector::PassiveInput & source,
145 connector::ActiveOutput & target)
146 : ForwardingRoute(module), source_(&source), target_(&target)
148 registerRoute(*target_);
151 prefix_ void senf::ppi::detail::BackwardForwardingRouteImplementation::v_notifyThrottle()
153 if (autoThrottling())
154 source_->notifyThrottle();
157 prefix_ void senf::ppi::detail::BackwardForwardingRouteImplementation::v_notifyUnthrottle()
159 if (autoThrottling())
160 source_->notifyUnthrottle();
163 ///////////////////////////////////////////////////////////////////////////
164 // senf::ppi::detail::ForwardForwardingRouteToEventImplementation
167 senf::ppi::detail::ForwardForwardingRouteToEventImplementation::
168 ForwardForwardingRouteToEventImplementation(module::Module & module,
169 connector::ActiveInput & source,
170 EventDescriptor & target)
171 : ForwardingRoute(module), source_(&source), target_(&target)
173 registerRoute(*source_);
176 prefix_ void senf::ppi::detail::ForwardForwardingRouteToEventImplementation::v_notifyThrottle()
178 if (autoThrottling())
179 target_->enabled(false);
183 senf::ppi::detail::ForwardForwardingRouteToEventImplementation::v_notifyUnthrottle()
185 if (autoThrottling())
186 target_->enabled(true);
189 ///////////////////////////////////////////////////////////////////////////
190 //senf::ppi::detail::BackwardForwardingRouteFromEventImplementation
193 senf::ppi::detail::BackwardForwardingRouteFromEventImplementation::
194 BackwardForwardingRouteFromEventImplementation(module::Module & module,
195 EventDescriptor & source,
196 connector::ActiveOutput & target)
197 : ForwardingRoute(module), source_(&source), target_(&target)
199 registerRoute(*target_);
203 senf::ppi::detail::BackwardForwardingRouteFromEventImplementation::v_notifyThrottle()
205 if (autoThrottling())
206 source_->enabled(false);
210 senf::ppi::detail::BackwardForwardingRouteFromEventImplementation::v_notifyUnthrottle()
212 if (autoThrottling())
213 source_->enabled(true);
216 ///////////////////////////////////////////////////////////////////////////
217 // senf::ppi::detail::RouteImplementation<connector::ActiveInput, connector::PassiveOutput,
221 senf::ppi::detail::RouteImplementation<senf::ppi::connector::ActiveInput,
222 senf::ppi::connector::PassiveOutput,
224 RouteImplementation(module::Module & module, connector::ActiveInput & source,
225 connector::PassiveOutput & target)
226 : ForwardForwardingRouteImplementation(module, source, target)
229 ////////////////////////////////////////////////////////////////////////////
230 // senf::ppi::detail::RouteImplementation<connector::PassiveInput, connector::ActiveOutput,
234 senf::ppi::detail::RouteImplementation<senf::ppi::connector::PassiveInput,
235 senf::ppi::connector::ActiveOutput,
237 RouteImplementation(module::Module & module, connector::PassiveInput & source,
238 connector::ActiveOutput & target)
239 : BackwardForwardingRouteImplementation(module, source, target)
242 ///////////////////////////////cci.e///////////////////////////////////////
249 // comment-column: 40
250 // c-file-style: "senf"
251 // indent-tabs-mode: nil
252 // ispell-local-dictionary: "american"
253 // compile-command: "scons -u test"