Utils/Logger: BUGFIX: Include local auto_unit_test header
[senf.git] / Utils / Logger / Config.ih
index 0cf9311..f2f6777 100644 (file)
@@ -1,8 +1,8 @@
 // $Id$
 //
-// Copyright (C) 2007 
-// Fraunhofer Institute for Open Communication Systems (FOKUS) 
-// Competence Center NETwork research (NET), St. Augustin, GERMANY 
+// 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
@@ -41,19 +41,33 @@ namespace senf {
 namespace log {
 namespace detail {
 
+    struct na {};
+
     /// Internal: Compile time configuration for given \a Stream and \a Area
-    template <class Stream, class Area>
+    template <class Stream, class Area, class QueryStream=Stream, bool Query=true>
     struct Config
     {
-        typedef typename Config<Stream,void>::compileLimit compileLimit;
+        typedef typename Config<na, Area, Stream, Query>::compileLimit compileLimit;
     };
 
 #   ifndef DOXYGEN
 
-    template <class Stream>
-    struct Config<Stream, void>
+    template <class Area, class QueryStream, bool Query>
+    struct Config<na, Area, QueryStream, Query>
+    {
+        typedef typename Config<QueryStream, na, QueryStream, Query>::compileLimit compileLimit;
+    };
+
+    template <class Stream, class QueryStream, bool Query>
+    struct Config<Stream, na, QueryStream, Query>
     {
-        typedef typename Stream::compileLimit compileLimit;
+        typedef typename Config<na, na, QueryStream, Query>::compileLimit compileLimit;
+    };
+
+    template <class QueryStream, bool Query>
+    struct Config<na, na, QueryStream, Query>
+    {
+        typedef typename QueryStream::compileLimit compileLimit;
     };
 
 #   endif
@@ -68,35 +82,42 @@ namespace detail {
 #define SENF_LOG_PREDECL_(s, state, elem)                                                         \
     namespace elem { state }
 
-#define SENF_LOG_PREDECL(seq)                                                                     \
+#define SENF_LOG_PREDECL_long(seq)                                                                \
     BOOST_PP_SEQ_FOLD_RIGHT( SENF_LOG_PREDECL_,                                                   \
                              class SENF_PP_SEQ_BACK(seq);,                                        \
                              BOOST_PP_SEQ_POP_BACK(seq) )
 
+#define SENF_LOG_PREDECL_short(seq)                                                               \
+        class SENF_PP_SEQ_BACK(seq);
+
+#define SENF_LOG_PREDECL(seq)                                                                     \
+    BOOST_PP_CAT(SENF_LOG_PREDECL_,                                                               \
+                 BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)),long,short))(seq)
+
 #define SENF_LOG_NIL(x)
 
 #define SENF_LOG_CONF_DEFINE(stream, area, level)                                                 \
     SENF_LOG_PREDECL(stream)                                                                      \
-    BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(area)),                                            \
-                SENF_LOG_PREDECL,                                                                 \
-                SENF_LOG_NIL)(area)                                                               \
+    SENF_LOG_PREDECL(area)                                                                        \
     namespace senf { namespace log { namespace detail {                                           \
-        template <>                                                                               \
+        template <class QueryStream>                                                              \
         struct Config< SENF_LOG_SEQ_TO_NAME(stream),                                              \
-                       BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(area)),                         \
-                                   SENF_LOG_SEQ_TO_NAME(area),                                    \
-                                   void) >                                                        \
+                       SENF_LOG_SEQ_TO_NAME(area),                                                \
+                       QueryStream,                                                               \
+                       true >                                                                     \
         { typedef senf::log::level compileLimit; };                                               \
     }}}
 
 #ifdef SENF_LOG_CONF
 
+#   define _ senf::log::detail::na
 #   define SLC_elt(r, data, elt) \
         SENF_LOG_CONF_DEFINE elt
 
     BOOST_PP_SEQ_FOR_EACH(SLC_elt, none, SENF_LOG_CONF)
 
 #   undef SLC_elt
+#   undef _
 
 #endif