Packets: Fix VariantParser invalid parser access bug
[senf.git] / PPI / Route.ih
index 149b9e9..31a4e5b 100644 (file)
@@ -1,8 +1,8 @@
 // $Id$
 //
-// Copyright (C) 2007 
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
+// Copyright (C) 2007
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
@@ -23,8 +23,8 @@
 /** \file
     \brief Route internal header */
 
-#ifndef IH_Route_
-#define IH_Route_ 1
+#ifndef IH_SENF_PPI_Route_
+#define IH_SENF_PPI_Route_ 1
 
 // Custom includes
 #include <boost/type_traits/is_convertible.hpp>
@@ -35,6 +35,8 @@
 
 ///////////////////////////////ih.p////////////////////////////////////////
 
+#ifndef DOXYGEN
+
 namespace senf {
 namespace ppi {
 namespace detail {
@@ -45,6 +47,8 @@ namespace detail {
     struct RoutingTraitsImplementation
     {
         BOOST_STATIC_ASSERT((boost::is_base_of<connector::Connector, Connector>::value));
+        
+        static bool const event = false;
 
         static bool const notifySource = boost::is_base_of<
             connector::ActiveConnector, Connector>::value;
@@ -64,6 +68,8 @@ namespace detail {
     template <class Event>
     struct RoutingTraitsImplementation<Event,true>
     {
+        static bool const event = true;
+
         static bool const notifySource = false;
         static bool const notifyTarget = true;
 
@@ -72,7 +78,7 @@ namespace detail {
 
         typedef EventDescriptor type;
     };
-    
+
     // The RoutingTraits give routing related information about the argument type:
     //  - Wether the type is a notifySource or notifyTarget
     //  - Wether the type is dataSource or dataTarget
@@ -97,8 +103,8 @@ namespace detail {
         typedef Source source_type;
         typedef Target target_type;
 
-        Source & source();
-        Target & target();
+        Source & source() const;
+        Target & target() const;
 
     protected:
         BaseRouteImplementation(module::Module & module, Source & source, Target & target);
@@ -131,18 +137,18 @@ namespace detail {
         ForwardingRouteImplementation(module::Module & module, Source & source, Target & target);
 
     private:
-        // register the Route in the notifySource only if the second argument is a 'true' type
-        template <class T> void registerRoute(T & ob, boost::mpl::bool_<true> const &);
-        template <class T> void registerRoute(T & ob, boost::mpl::bool_<false> const &);
-
         // send a throttle/unthrottle notification  only if the second argument is a 'true' type
         template <class T> void notifyThrottle(T & ob, boost::mpl::bool_<true> const &);
         template <class T> void notifyThrottle(T & ob, boost::mpl::bool_<false> const &);
         template <class T> void notifyUnthrottle(T & ob, boost::mpl::bool_<true> const &);
         template <class T> void notifyUnthrottle(T & ob, boost::mpl::bool_<false> const &);
 
+        template <class T> bool throttled(T & ob, boost::mpl::bool_<true> const &) const;
+        template <class T> bool throttled(T & ob, boost::mpl::bool_<false> const &) const;
+
         virtual void v_notifyThrottle();
         virtual void v_notifyUnthrottle();
+        virtual bool v_throttled() const;
     };
 
     // This helper class finds the base-class suitable for a specific route. Routes are classified
@@ -199,6 +205,8 @@ namespace detail {
 
 }}}
 
+#endif
+
 ///////////////////////////////ih.e////////////////////////////////////////
 #endif