4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at
9 // http://senf.berlios.de/license.html
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on,
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
15 // Software distributed under the License is distributed on an "AS IS" basis,
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17 // for the specific language governing rights and limitations under the License.
19 // The Original Code is Fraunhofer FOKUS code.
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
26 // Stefan Bund <g0dil@berlios.de>
29 \brief Route inline template implementation */
35 #define prefix_ inline
36 //-/////////////////////////////////////////////////////////////////////////////////////////////////
38 //-/////////////////////////////////////////////////////////////////////////////////////////////////
39 // senf::ppi::Route<Source,Target>
41 template <class Source, class Target>
42 prefix_ senf::ppi::Route<Source,Target>::Route(module::Module & module, Source & source,
44 : Base(module,source,target)
47 //-/////////////////////////////////////////////////////////////////////////////////////////////////
48 // senf::ppi::ForwardingRoute
50 //-/////////////////////////////////////////////////////////////////////////////////////////////////
54 prefix_ void senf::ppi::ForwardingRoute::registerRoute(T & ob)
56 ob.registerRoute(*this);
60 prefix_ void senf::ppi::ForwardingRoute::unregisterRoute(T & ob)
62 ob.unregisterRoute(*this);
66 prefix_ void senf::ppi::ForwardingRoute::notifyThrottle(T & ob)
72 prefix_ void senf::ppi::ForwardingRoute::notifyUnthrottle(T & ob)
74 ob.notifyUnthrottle();
77 //-/////////////////////////////////////////////////////////////////////////////////////////////////
78 // senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>
80 template <class Source, class Target, class Base>
81 prefix_ Source & senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::source()
87 template <class Source, class Target, class Base>
88 prefix_ Target & senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::target()
94 //-/////////////////////////////////////////////////////////////////////////////////////////////////
97 template <class Source, class Target, class Base>
98 prefix_ senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::
99 BaseRouteImplementation(module::Module & module, Source & source, Target & target)
100 : Base(module), source_(&source), target_(&target)
103 //-/////////////////////////////////////////////////////////////////////////////////////////////////
106 template <class Source, class Target, class Base>
107 prefix_ bool senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::
108 v_hasConnector(connector::Connector const & conn)
111 return isSame(conn, source()) || isSame(conn, target());
114 template <class Source, class Target, class Base>
115 prefix_ bool senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::
116 v_hasEvent(EventDescriptor const & event)
119 return isSame(event, source()) || isSame(event, target());
122 template <class Source, class Target, class Base>
123 prefix_ bool senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::
124 isSame(connector::Connector const & conn, connector::Connector const & other)
127 return &conn == &other;
130 template <class Source, class Target, class Base>
131 prefix_ bool senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::
132 isSame(connector::Connector const & conn, EventDescriptor const & other)
138 template <class Source, class Target, class Base>
139 prefix_ bool senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::
140 isSame(EventDescriptor const & event, connector::Connector const & other)
146 template <class Source, class Target, class Base>
147 prefix_ bool senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::
148 isSame(EventDescriptor const & event, EventDescriptor const & other)
151 return &event == &other;
154 //-/////////////////////////////////////////////////////////////////////////////////////////////////
155 // senf::ppi::detail::ForwardingRouteImplementation<Source,Target>
157 //-/////////////////////////////////////////////////////////////////////////////////////////////////
160 template <class Source, class Target>
162 senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
163 ForwardingRouteImplementation(module::Module & module, Source & source, Target & target)
164 : Base(module,source,target)
166 Base::registerRoute(source);
167 Base::registerRoute(target);
170 template <class Source, class Target>
172 senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
173 ~ForwardingRouteImplementation()
175 Base::unregisterRoute(this->source());
176 Base::unregisterRoute(this->target());
179 //-/////////////////////////////////////////////////////////////////////////////////////////////////
182 template <class Source, class Target>
184 prefix_ void senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
185 notifyThrottle(T & ob, boost::mpl::bool_<true> const &)
187 ForwardingRoute::notifyThrottle(ob);
190 template <class Source, class Target>
192 prefix_ void senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
193 notifyThrottle(T & ob, boost::mpl::bool_<false> const &)
196 template <class Source, class Target>
198 prefix_ void senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
199 notifyUnthrottle(T & ob, boost::mpl::bool_<true> const &)
201 ForwardingRoute::notifyUnthrottle(ob);
204 template <class Source, class Target>
206 prefix_ void senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
207 notifyUnthrottle(T & ob, boost::mpl::bool_<false> const &)
210 template <class Source, class Target>
212 prefix_ bool senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
213 throttled(T & ob, boost::mpl::bool_<true> const &)
216 return ob.throttled();
219 template <class Source, class Target>
221 prefix_ bool senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
222 throttled(T & ob, boost::mpl::bool_<false> const &)
228 //-/////////////////////////////////////////////////////////////////////////////////////////////////
229 // senf::ppi::detail::RouteImplementation2<Source,Target>
231 //-/////////////////////////////////////////////////////////////////////////////////////////////////
234 template <class Source, class Target>
235 prefix_ senf::ppi::detail::RouteImplementation2<Source,Target>::
236 RouteImplementation2(module::Module & module, Source & source, Target & target)
237 : Base(module,source,target)
240 //-/////////////////////////////////////////////////////////////////////////////////////////////////
241 // senf::ppi::detail::RouteImplementation<Source,Target>
243 //-/////////////////////////////////////////////////////////////////////////////////////////////////
246 template <class Source, class Target>
247 prefix_ senf::ppi::detail::RouteImplementation<Source,Target>::
248 RouteImplementation(module::Module & module, Source & source, Target & target)
249 : Base(module,source,target)
252 //-/////////////////////////////////////////////////////////////////////////////////////////////////
259 // comment-column: 40
260 // c-file-style: "senf"
261 // indent-tabs-mode: nil
262 // ispell-local-dictionary: "american"
263 // compile-command: "scons -u test"