X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FLogger%2FConfig.ih;h=1ead3fcb3153940283fce44e30bad28bd5c25e27;hb=be1bf122a03b2105973d2dd0798a2a450cd676a6;hp=6fec5029587d206d045703a24ad12716d61ad2b9;hpb=61419d9a2e1060f7ede22fa19fd9d0b401bbc87a;p=senf.git diff --git a/Utils/Logger/Config.ih b/Utils/Logger/Config.ih index 6fec502..1ead3fc 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 @@ -41,17 +41,19 @@ namespace senf { namespace log { namespace detail { + 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 + struct Config { typedef typename Stream::compileLimit compileLimit; }; @@ -68,36 +70,40 @@ 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 <> \ 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) > \ { 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 - // Need to use fold here to not exhaust the maximum FOR nesting depth ... BOOST_PP_SEQ_FOR_EACH(SLC_elt, none, SENF_LOG_CONF) # undef SLC_elt +# undef _ #endif