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.hh

Go to the documentation of this file.
00001 // $Id: Route.hh 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 #ifndef HH_SENF_PPI_Route_
00027 #define HH_SENF_PPI_Route_ 1
00028 
00029 // Custom includes
00030 #include <boost/type_traits.hpp>
00031 #include "predecl.hh"
00032 
00033 //#include "Route.mpp"
00034 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00035 
00036 namespace senf {
00037 namespace ppi {
00038 
00044     class RouteBase
00045     {
00046     public:
00047         virtual ~RouteBase();
00048 
00049 #ifdef DOXYGEN
00050         Source & source() const;        
00051 
00054         Target & target() const;        
00055 
00058 #endif
00059 
00060         bool hasConnector(connector::Connector const & conn) const;
00062         bool hasEvent(EventDescriptor const & event) const;
00064 
00065     protected:
00066         RouteBase(module::Module & module);
00067 
00068     private:
00069         virtual bool v_hasConnector(connector::Connector const & conn) const = 0;
00070         virtual bool v_hasEvent(EventDescriptor const & event) const = 0;
00071 
00072         module::Module * module_;
00073     };
00074 
00081     class ForwardingRoute
00082         : public RouteBase
00083     {
00084     public:
00085         bool autoThrottling() const;    
00086         void autoThrottling(bool state); 
00087 
00101         bool throttled() const;         
00102 
00106     protected:
00107         ForwardingRoute(module::Module & module);
00108 
00109         // Called to register this route with the connectors forwarding information base
00110         template <class T> void registerRoute(T & ob);
00111         template <class T> void unregisterRoute(T & ob);
00112 
00113         template <class T> void notifyThrottle(T & ob);
00114         template <class T> void notifyUnthrottle(T & ob);
00115 
00116     private:
00117         // called to forward a throttling notification along the route
00118         void notifyThrottle();
00119         void notifyUnthrottle();
00120 
00121         // Implemented in the derived classes to forward throttling notifications
00122         virtual void v_notifyThrottle() = 0;
00123         virtual void v_notifyUnthrottle() = 0;
00124         virtual bool v_throttled() const = 0;
00125 
00126         bool autoThrottling_;
00127 
00128         friend class connector::ActiveConnector;
00129     };
00130 
00131 }}
00132 
00133 // We need detail::RouteImplementation here ...
00134 #include "Route.ih"
00135 
00136 namespace senf {
00137 namespace ppi {
00138 
00154     template <class Source, class Target>
00155     class Route
00156         : public detail::RouteImplementation<Source,Target>
00157     {
00158     private:
00159         typedef detail::RouteImplementation<Source,Target> Base;
00160         typedef detail::RouteImplementation<Source,Target> Implementation;
00161 
00162         Route(module::Module & module, Source & source, Target & target);
00163 
00164         friend class module::Module;
00165     };
00166 
00167 }}
00168 
00169 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00170 #include "Route.cci"
00171 #include "Route.ct"
00172 #include "Route.cti"
00173 #endif
00174 
00175 
00176 // Local Variables:
00177 // mode: c++
00178 // fill-column: 100
00179 // c-file-style: "senf"
00180 // indent-tabs-mode: nil
00181 // ispell-local-dictionary: "american"
00182 // compile-command: "scons -u test"
00183 // comment-column: 40
00184 // End:

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