Search:

SENF Extensible Network Framework

  • Home
  • Download
  • Wiki
  • BerliOS
  • ChangeLog
  • Browse SVN
  • Bug Tracker
  • Overview
  • Examples
  • HowTos
  • Glossary
  • PPI
  • Packets
  • Scheduler
  • Socket
  • Utils
  • Console
  • Daemon
  • Logger
  • Termlib
  • Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • Directories
  • File List
  • File Members

Route.cti

Go to the documentation of this file.
00001 // $Id: Route.cti 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2007
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Stefan Bund <g0dil@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00026 #include "Route.ih"
00027 
00028 // Custom includes
00029 
00030 #define prefix_ inline
00031 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00032 
00033 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00034 // senf::ppi::Route<Source,Target>
00035 
00036 template <class Source, class Target>
00037 prefix_ senf::ppi::Route<Source,Target>::Route(module::Module & module, Source & source,
00038                                                Target & target)
00039     : Base(module,source,target)
00040 {}
00041 
00042 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00043 // senf::ppi::ForwardingRoute
00044 
00045 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00046 // protected members
00047 
00048 template <class T>
00049 prefix_ void senf::ppi::ForwardingRoute::registerRoute(T & ob)
00050 {
00051     ob.registerRoute(*this);
00052 }
00053 
00054 template <class T>
00055 prefix_ void senf::ppi::ForwardingRoute::unregisterRoute(T & ob)
00056 {
00057     ob.unregisterRoute(*this);
00058 }
00059 
00060 template <class T>
00061 prefix_ void senf::ppi::ForwardingRoute::notifyThrottle(T & ob)
00062 {
00063     ob.notifyThrottle();
00064 }
00065 
00066 template <class T>
00067 prefix_ void senf::ppi::ForwardingRoute::notifyUnthrottle(T & ob)
00068 {
00069     ob.notifyUnthrottle();
00070 }
00071 
00072 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00073 // senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>
00074 
00075 template <class Source, class Target, class Base>
00076 prefix_ Source & senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::source()
00077     const
00078 {
00079     return *source_;
00080 }
00081 
00082 template <class Source, class Target, class Base>
00083 prefix_ Target & senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::target()
00084     const
00085 {
00086     return *target_;
00087 }
00088 
00089 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00090 // protected members
00091 
00092 template <class Source, class Target, class Base>
00093 prefix_ senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::
00094 BaseRouteImplementation(module::Module & module, Source & source, Target & target)
00095     : Base(module), source_(&source), target_(&target)
00096 {}
00097 
00098 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00099 // private members
00100 
00101 template <class Source, class Target, class Base>
00102 prefix_ bool senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::
00103 v_hasConnector(connector::Connector const & conn)
00104     const
00105 {
00106     return isSame(conn, source()) || isSame(conn, target());
00107 }
00108 
00109 template <class Source, class Target, class Base>
00110 prefix_ bool senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::
00111 v_hasEvent(EventDescriptor const & event)
00112     const
00113 {
00114     return isSame(event, source()) || isSame(event, target());
00115 }
00116 
00117 template <class Source, class Target, class Base>
00118 prefix_ bool senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::
00119 isSame(connector::Connector const & conn, connector::Connector const & other)
00120     const
00121 {
00122     return &conn == &other;
00123 }
00124 
00125 template <class Source, class Target, class Base>
00126 prefix_ bool senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::
00127 isSame(connector::Connector const & conn, EventDescriptor const & other)
00128     const
00129 {
00130     return false;
00131 }
00132 
00133 template <class Source, class Target, class Base>
00134 prefix_ bool senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::
00135 isSame(EventDescriptor const & event, connector::Connector const & other)
00136     const
00137 {
00138     return false;
00139 }
00140 
00141 template <class Source, class Target, class Base>
00142 prefix_ bool senf::ppi::detail::BaseRouteImplementation<Source,Target,Base>::
00143 isSame(EventDescriptor const & event, EventDescriptor const & other)
00144     const
00145 {
00146     return &event == &other;
00147 }
00148 
00149 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00150 // senf::ppi::detail::ForwardingRouteImplementation<Source,Target>
00151 
00152 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00153 // protected members
00154 
00155 template <class Source, class Target>
00156 prefix_
00157 senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
00158 ForwardingRouteImplementation(module::Module & module, Source & source, Target & target)
00159     : Base(module,source,target)
00160 {
00161     registerRoute(source);
00162     registerRoute(target);
00163 }
00164 
00165 template <class Source, class Target>
00166 prefix_
00167 senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
00168 ~ForwardingRouteImplementation()
00169 {
00170     unregisterRoute(this->source());
00171     unregisterRoute(this->target());
00172 }
00173 
00174 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00175 // private members
00176 
00177 template <class Source, class Target>
00178 template <class T>
00179 prefix_ void senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
00180 notifyThrottle(T & ob, boost::mpl::bool_<true> const &)
00181 {
00182     ForwardingRoute::notifyThrottle(ob);
00183 }
00184 
00185 template <class Source, class Target>
00186 template <class T>
00187 prefix_ void senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
00188 notifyThrottle(T & ob, boost::mpl::bool_<false> const &)
00189 {}
00190 
00191 template <class Source, class Target>
00192 template <class T>
00193 prefix_ void senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
00194 notifyUnthrottle(T & ob, boost::mpl::bool_<true> const &)
00195 {
00196     ForwardingRoute::notifyUnthrottle(ob);
00197 }
00198 
00199 template <class Source, class Target>
00200 template <class T>
00201 prefix_ void senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
00202 notifyUnthrottle(T & ob, boost::mpl::bool_<false> const &)
00203 {}
00204 
00205 template <class Source, class Target>
00206 template <class T>
00207 prefix_ bool senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
00208 throttled(T & ob, boost::mpl::bool_<true> const &)
00209     const
00210 {
00211     return ob.throttled();
00212 }
00213 
00214 template <class Source, class Target>
00215 template <class T>
00216 prefix_ bool senf::ppi::detail::ForwardingRouteImplementation<Source,Target>::
00217 throttled(T & ob, boost::mpl::bool_<false> const &)
00218     const
00219 {
00220     return false;
00221 }
00222 
00223 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00224 // senf::ppi::detail::RouteImplementation2<Source,Target>
00225 
00226 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00227 // protected members
00228 
00229 template <class Source, class Target>
00230 prefix_ senf::ppi::detail::RouteImplementation2<Source,Target>::
00231 RouteImplementation2(module::Module & module, Source & source, Target & target)
00232     : Base(module,source,target)
00233 {}
00234 
00235 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00236 // senf::ppi::detail::RouteImplementation<Source,Target>
00237 
00238 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00239 // protected members
00240 
00241 template <class Source, class Target>
00242 prefix_ senf::ppi::detail::RouteImplementation<Source,Target>::
00243 RouteImplementation(module::Module & module, Source & source, Target & target)
00244     : Base(module,source,target)
00245 {}
00246 
00247 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00248 #undef prefix_
00249 
00250 
00251 // Local Variables:
00252 // mode: c++
00253 // fill-column: 100
00254 // comment-column: 40
00255 // c-file-style: "senf"
00256 // indent-tabs-mode: nil
00257 // ispell-local-dictionary: "american"
00258 // compile-command: "scons -u test"
00259 // End:

Contact: senf-dev@lists.berlios.de | © 2006-2010 Fraunhofer Institute for Open Communication Systems, Network Research