Packets: Fix VariantParser invalid parser access bug
[senf.git] / Utils / Logger / Parameters.ih
index 9c6529c..4941b79 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 Parameters internal header */
 
-#ifndef IH_Parameters_
-#define IH_Parameters_ 1
+#ifndef IH_SENF_Utils_Logger_Parameters_
+#define IH_SENF_Utils_Logger_Parameters_ 1
 
 // Custom includes
 #include <iostream>
 #include <boost/mpl/vector.hpp>
 #include <boost/mpl/fold.hpp>
 #include <boost/mpl/if.hpp>
+#include <boost/utility.hpp>
+#include <boost/type_traits/is_convertible.hpp>
 #include "../mpl.hh"
 #include "Config.hh"
+#include "Target.hh"
 
 ///////////////////////////////ih.p////////////////////////////////////////
 
@@ -67,7 +70,7 @@ namespace detail {
     senf::mpl::rv<2> Parameters_select_(AreaBase *);
     template <class Base, class Param>
     struct Parameters_<Base,Param,2> : public Base
-    { typedef Param area; };
+    { typedef Param area; typedef Param area_base; };
 
     senf::mpl::rv<3> Parameters_select_(LevelBase *);
     template <class Base, class Param>
@@ -96,7 +99,7 @@ namespace detail {
         typename boost::disable_if< boost::is_convertible<T*,AliasBase*> >::type * = 0);
     template <class Base, class Param>
     struct Parameters_<Base,Param,6> : public Base
-    { typedef typename Param::SENFLogArea area; };
+    { typedef typename Param::SENFLogArea area; typedef Param area_base; };
 
 #endif
 
@@ -110,13 +113,13 @@ namespace detail {
 
         static bool const compileEnabled = senf::log::Enabled<
             typename Base::stream, 
-            typename Base::area, 
+            typename Base::area_base, 
             level>::value;
 
         static bool enabled() { 
             return compileEnabled
-                && Base::area::instance().streamLimit(Base::stream::instance()) 
-                <= Base::level::value;
+                && ( senf::log::detail::TargetRegistry::instance().fallbackRouting() ||
+                     Base::area::instance().limit(Base::stream::instance()) <= level::value );
         }
     };