00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00026 #ifndef HH_SENF_PPI_Route_
00027 #define HH_SENF_PPI_Route_ 1
00028
00029
00030 #include <boost/type_traits.hpp>
00031 #include "predecl.hh"
00032
00033
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
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
00118 void notifyThrottle();
00119 void notifyUnthrottle();
00120
00121
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
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
00177
00178
00179
00180
00181
00182
00183
00184