// $Id$ // // Copyright (C) 2007 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /** \file \brief Route inline template implementation */ #include "Route.ih" // Custom includes #define prefix_ inline //-///////////////////////////////////////////////////////////////////////////////////////////////// //-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::ppi::Route template prefix_ senf::ppi::Route::Route(module::Module & module, Source & source, Target & target) : Base(module,source,target) {} //-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::ppi::ForwardingRoute //-///////////////////////////////////////////////////////////////////////////////////////////////// // protected members template prefix_ void senf::ppi::ForwardingRoute::registerRoute(T & ob) { ob.registerRoute(*this); } template prefix_ void senf::ppi::ForwardingRoute::unregisterRoute(T & ob) { ob.unregisterRoute(*this); } template prefix_ void senf::ppi::ForwardingRoute::notifyThrottle(T & ob) { ob.notifyThrottle(); } template prefix_ void senf::ppi::ForwardingRoute::notifyUnthrottle(T & ob) { ob.notifyUnthrottle(); } //-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::ppi::detail::BaseRouteImplementation template prefix_ Source & senf::ppi::detail::BaseRouteImplementation::source() const { return *source_; } template prefix_ Target & senf::ppi::detail::BaseRouteImplementation::target() const { return *target_; } //-///////////////////////////////////////////////////////////////////////////////////////////////// // protected members template prefix_ senf::ppi::detail::BaseRouteImplementation:: BaseRouteImplementation(module::Module & module, Source & source, Target & target) : Base(module), source_(&source), target_(&target) {} //-///////////////////////////////////////////////////////////////////////////////////////////////// // private members template prefix_ bool senf::ppi::detail::BaseRouteImplementation:: v_hasConnector(connector::Connector const & conn) const { return isSame(conn, source()) || isSame(conn, target()); } template prefix_ bool senf::ppi::detail::BaseRouteImplementation:: v_hasEvent(EventDescriptor const & event) const { return isSame(event, source()) || isSame(event, target()); } template prefix_ bool senf::ppi::detail::BaseRouteImplementation:: isSame(connector::Connector const & conn, connector::Connector const & other) const { return &conn == &other; } template prefix_ bool senf::ppi::detail::BaseRouteImplementation:: isSame(connector::Connector const & conn, EventDescriptor const & other) const { return false; } template prefix_ bool senf::ppi::detail::BaseRouteImplementation:: isSame(EventDescriptor const & event, connector::Connector const & other) const { return false; } template prefix_ bool senf::ppi::detail::BaseRouteImplementation:: isSame(EventDescriptor const & event, EventDescriptor const & other) const { return &event == &other; } //-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::ppi::detail::ForwardingRouteImplementation //-///////////////////////////////////////////////////////////////////////////////////////////////// // protected members template prefix_ senf::ppi::detail::ForwardingRouteImplementation:: ForwardingRouteImplementation(module::Module & module, Source & source, Target & target) : Base(module,source,target) { registerRoute(source); registerRoute(target); } template prefix_ senf::ppi::detail::ForwardingRouteImplementation:: ~ForwardingRouteImplementation() { unregisterRoute(this->source()); unregisterRoute(this->target()); } //-///////////////////////////////////////////////////////////////////////////////////////////////// // private members template template prefix_ void senf::ppi::detail::ForwardingRouteImplementation:: notifyThrottle(T & ob, boost::mpl::bool_ const &) { ForwardingRoute::notifyThrottle(ob); } template template prefix_ void senf::ppi::detail::ForwardingRouteImplementation:: notifyThrottle(T & ob, boost::mpl::bool_ const &) {} template template prefix_ void senf::ppi::detail::ForwardingRouteImplementation:: notifyUnthrottle(T & ob, boost::mpl::bool_ const &) { ForwardingRoute::notifyUnthrottle(ob); } template template prefix_ void senf::ppi::detail::ForwardingRouteImplementation:: notifyUnthrottle(T & ob, boost::mpl::bool_ const &) {} template template prefix_ bool senf::ppi::detail::ForwardingRouteImplementation:: throttled(T & ob, boost::mpl::bool_ const &) const { return ob.throttled(); } template template prefix_ bool senf::ppi::detail::ForwardingRouteImplementation:: throttled(T & ob, boost::mpl::bool_ const &) const { return false; } //-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::ppi::detail::RouteImplementation2 //-///////////////////////////////////////////////////////////////////////////////////////////////// // protected members template prefix_ senf::ppi::detail::RouteImplementation2:: RouteImplementation2(module::Module & module, Source & source, Target & target) : Base(module,source,target) {} //-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::ppi::detail::RouteImplementation //-///////////////////////////////////////////////////////////////////////////////////////////////// // protected members template prefix_ senf::ppi::detail::RouteImplementation:: RouteImplementation(module::Module & module, Source & source, Target & target) : Base(module,source,target) {} //-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_ // Local Variables: // mode: c++ // fill-column: 100 // comment-column: 40 // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" // compile-command: "scons -u test" // End: