4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at
9 // http://senf.berlios.de/license.html
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on,
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
15 // Software distributed under the License is distributed on an "AS IS" basis,
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17 // for the specific language governing rights and limitations under the License.
19 // The Original Code is Fraunhofer FOKUS code.
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
26 // Stefan Bund <g0dil@berlios.de>
29 \brief Config internal header */
31 #ifndef IH_SENF_Utils_Logger_Config_
32 #define IH_SENF_Utils_Logger_Config_ 1
35 #include <boost/preprocessor/expand.hpp>
36 #include <boost/preprocessor/seq/for_each.hpp>
37 #include <boost/preprocessor/seq/to_tuple.hpp>
38 #include <boost/preprocessor/seq/fold_right.hpp>
39 #include <boost/preprocessor/seq/pop_back.hpp>
40 #include <boost/preprocessor/if.hpp>
41 #include <boost/preprocessor/facilities/is_empty.hpp>
42 #include <senf/Utils/preprocessor.hh>
44 //-/////////////////////////////////////////////////////////////////////////////////////////////////
52 /// Internal: Compile time configuration for given \a Stream and \a Area
53 template <class Stream, class Area, class QueryStream=Stream, bool Query=true>
56 typedef typename Config<na, Area, Stream, Query>::compileLimit compileLimit;
61 template <class Area, class QueryStream, bool Query>
62 struct Config<na, Area, QueryStream, Query>
64 typedef typename Config<QueryStream, na, QueryStream, Query>::compileLimit compileLimit;
67 template <class Stream, class QueryStream, bool Query>
68 struct Config<Stream, na, QueryStream, Query>
70 typedef typename Config<na, na, QueryStream, Query>::compileLimit compileLimit;
73 template <class QueryStream, bool Query>
74 struct Config<na, na, QueryStream, Query>
76 typedef typename QueryStream::compileLimit compileLimit;
83 #define SENF_LOG_CHECK_NA_
85 #define SENF_LOG_CAT(a,b) SENF_LOG_CAT_I(a,b)
86 #define SENF_LOG_CAT_I(a,b) a ## b
88 #define SENF_LOG_IS_NA(elt) BOOST_PP_IS_EMPTY( SENF_LOG_CAT(SENF_LOG_CHECK_NA, elt) )
90 #define SENF_LOG_SEQ_TO_NAME_(s,state,elem) \
91 BOOST_PP_IF( SENF_LOG_IS_NA(elem), senf::log::detail::na, state::elem )
93 #define SENF_LOG_SEQ_TO_NAME(seq) \
94 BOOST_PP_SEQ_FOLD_LEFT(SENF_LOG_SEQ_TO_NAME_, , seq)
96 #define SENF_LOG_PREDECL_(s, state, elem) \
97 namespace elem { state }
99 #define SENF_LOG_PREDECL_long(seq) \
100 BOOST_PP_SEQ_FOLD_RIGHT( SENF_LOG_PREDECL_, \
101 struct SENF_PP_SEQ_BACK(seq);, \
102 BOOST_PP_SEQ_POP_BACK(seq) )
104 #define SENF_LOG_PREDECL_short(seq) \
105 BOOST_PP_IF( SENF_LOG_IS_NA( SENF_PP_SEQ_BACK(seq) ), ; , struct SENF_PP_SEQ_BACK(seq); )
107 #define SENF_LOG_PREDECL(seq) \
108 BOOST_PP_CAT(SENF_LOG_PREDECL_, \
109 BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)),long,short))(seq)
111 #define SENF_LOG_NIL(x)
113 #define SENF_LOG_CONF_DEFINE(stream, area, level) \
114 SENF_LOG_PREDECL(stream) \
115 SENF_LOG_PREDECL(area) \
116 namespace senf { namespace log { namespace detail { \
117 template <class QueryStream> \
118 struct Config< SENF_LOG_SEQ_TO_NAME(stream), \
119 SENF_LOG_SEQ_TO_NAME(area), \
122 { typedef senf::log::level compileLimit; }; \
127 # define SLC_elt(r, data, elt) \
128 SENF_LOG_CONF_DEFINE elt
130 BOOST_PP_SEQ_FOR_EACH(SLC_elt, none, SENF_LOG_CONF)
139 //-/////////////////////////////////////////////////////////////////////////////////////////////////
146 // comment-column: 40
147 // c-file-style: "senf"
148 // indent-tabs-mode: nil
149 // ispell-local-dictionary: "american"
150 // compile-command: "scons -u test"