4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief Config internal header */
30 #include <boost/preprocessor/expand.hpp>
31 #include <boost/preprocessor/seq/for_each.hpp>
32 #include <boost/preprocessor/seq/to_tuple.hpp>
33 #include <boost/preprocessor/seq/fold_right.hpp>
34 #include <boost/preprocessor/seq/pop_back.hpp>
35 #include <boost/preprocessor/if.hpp>
36 #include <boost/preprocessor/facilities/is_empty.hpp>
37 #include "../preprocessor.hh"
39 ///////////////////////////////ih.p////////////////////////////////////////
47 /// Internal: Compile time configuration for given \a Stream and \a Area
48 template <class Stream, class Area, class QueryStream=Stream, bool Query=true>
51 typedef typename Config<na, Area, Stream, Query>::compileLimit compileLimit;
56 template <class Area, class QueryStream, bool Query>
57 struct Config<na, Area, QueryStream, Query>
59 typedef typename Config<QueryStream, na, QueryStream, Query>::compileLimit compileLimit;
62 template <class Stream, class QueryStream, bool Query>
63 struct Config<Stream, na, QueryStream, Query>
65 typedef typename Config<na, na, QueryStream, Query>::compileLimit compileLimit;
68 template <class QueryStream, bool Query>
69 struct Config<na, na, QueryStream, Query>
71 typedef typename QueryStream::compileLimit compileLimit;
78 #define SENF_LOG_CHECK_NA_
80 #define SENF_LOG_CAT(a,b) SENF_LOG_CAT_I(a,b)
81 #define SENF_LOG_CAT_I(a,b) a ## b
83 #define SENF_LOG_IS_NA(elt) BOOST_PP_IS_EMPTY( SENF_LOG_CAT(SENF_LOG_CHECK_NA, elt) )
85 #define SENF_LOG_SEQ_TO_NAME_(s,state,elem) \
86 BOOST_PP_IF( SENF_LOG_IS_NA(elem), senf::log::detail::na, state::elem )
88 #define SENF_LOG_SEQ_TO_NAME(seq) \
89 BOOST_PP_SEQ_FOLD_LEFT(SENF_LOG_SEQ_TO_NAME_, , seq)
91 #define SENF_LOG_PREDECL_(s, state, elem) \
92 namespace elem { state }
94 #define SENF_LOG_PREDECL_long(seq) \
95 BOOST_PP_SEQ_FOLD_RIGHT( SENF_LOG_PREDECL_, \
96 class SENF_PP_SEQ_BACK(seq);, \
97 BOOST_PP_SEQ_POP_BACK(seq) )
99 #define SENF_LOG_PREDECL_short(seq) \
100 BOOST_PP_IF( SENF_LOG_IS_NA( SENF_PP_SEQ_BACK(seq) ), ; , class SENF_PP_SEQ_BACK(seq); )
102 #define SENF_LOG_PREDECL(seq) \
103 BOOST_PP_CAT(SENF_LOG_PREDECL_, \
104 BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)),long,short))(seq)
106 #define SENF_LOG_NIL(x)
108 #define SENF_LOG_CONF_DEFINE(stream, area, level) \
109 SENF_LOG_PREDECL(stream) \
110 SENF_LOG_PREDECL(area) \
111 namespace senf { namespace log { namespace detail { \
112 template <class QueryStream> \
113 struct Config< SENF_LOG_SEQ_TO_NAME(stream), \
114 SENF_LOG_SEQ_TO_NAME(area), \
117 { typedef senf::log::level compileLimit; }; \
122 # define SLC_elt(r, data, elt) \
123 SENF_LOG_CONF_DEFINE elt
125 BOOST_PP_SEQ_FOR_EACH(SLC_elt, none, SENF_LOG_CONF)
134 ///////////////////////////////ih.e////////////////////////////////////////
141 // comment-column: 40
142 // c-file-style: "senf"
143 // indent-tabs-mode: nil
144 // ispell-local-dictionary: "american"
145 // compile-command: "scons -u test"