X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FLogger%2FConfig.ih;h=a850fdea4f848de373e15ba193ffde9078736130;hb=f2f5d59e83863f3b513950173baee1b6da2aee3c;hp=10b9e4a349677b0a656d7daae872b158b00c4b0a;hpb=9ff976ea47b175355a1f7ef4d05f14edb98a82e4;p=senf.git diff --git a/Utils/Logger/Config.ih b/Utils/Logger/Config.ih index 10b9e4a..a850fde 100644 --- a/Utils/Logger/Config.ih +++ b/Utils/Logger/Config.ih @@ -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 // // This program is free software; you can redistribute it and/or modify @@ -23,8 +23,8 @@ /** \file \brief Config internal header */ -#ifndef IH_Config_ -#define IH_Config_ 1 +#ifndef IH_SENF_Utils_Logger_Config_ +#define IH_SENF_Utils_Logger_Config_ 1 // Custom includes #include @@ -33,6 +33,7 @@ #include #include #include +#include #include "../preprocessor.hh" ///////////////////////////////ih.p//////////////////////////////////////// @@ -41,56 +42,87 @@ namespace senf { namespace log { namespace detail { - template + struct na {}; + + /// Internal: Compile time configuration for given \a Stream and \a Area + template struct Config { - typedef typename Config::compileLimit compileLimit; + typedef typename Config::compileLimit compileLimit; + }; + +# ifndef DOXYGEN + + template + struct Config + { + typedef typename Config::compileLimit compileLimit; + }; + + template + struct Config + { + typedef typename Config::compileLimit compileLimit; }; - template - struct Config + template + struct Config { - typedef typename Stream::compileLimit compileLimit; + typedef typename QueryStream::compileLimit compileLimit; }; +# endif + }}} -#define SENF_LOG_SEQ_TO_NAME_(s,data,elem) ::elem +#define SENF_LOG_CHECK_NA_ + +#define SENF_LOG_CAT(a,b) SENF_LOG_CAT_I(a,b) +#define SENF_LOG_CAT_I(a,b) a ## b + +#define SENF_LOG_IS_NA(elt) BOOST_PP_IS_EMPTY( SENF_LOG_CAT(SENF_LOG_CHECK_NA, elt) ) + +#define SENF_LOG_SEQ_TO_NAME_(s,state,elem) \ + BOOST_PP_IF( SENF_LOG_IS_NA(elem), senf::log::detail::na, state::elem ) #define SENF_LOG_SEQ_TO_NAME(seq) \ - BOOST_PP_SEQ_FOR_EACH(SENF_LOG_SEQ_TO_NAME_, none, seq) + BOOST_PP_SEQ_FOLD_LEFT(SENF_LOG_SEQ_TO_NAME_, , seq) #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) \ + BOOST_PP_IF( SENF_LOG_IS_NA( SENF_PP_SEQ_BACK(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 \ 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 SLC_elt(s, state, elt) \ +# define SLC_elt(r, data, elt) \ SENF_LOG_CONF_DEFINE elt - // Need to use fold here to not exhaust the maximum FOR nesting depth ... - BOOST_PP_SEQ_FOLD_LEFT(SLC_elt, none, SENF_LOG_CONF) + BOOST_PP_SEQ_FOR_EACH(SLC_elt, none, SENF_LOG_CONF) # undef SLC_elt