00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00026 #ifndef IH_SENF_Utils_Logger_Config_
00027 #define IH_SENF_Utils_Logger_Config_ 1
00028
00029
00030 #include <boost/preprocessor/expand.hpp>
00031 #include <boost/preprocessor/seq/for_each.hpp>
00032 #include <boost/preprocessor/seq/to_tuple.hpp>
00033 #include <boost/preprocessor/seq/fold_right.hpp>
00034 #include <boost/preprocessor/seq/pop_back.hpp>
00035 #include <boost/preprocessor/if.hpp>
00036 #include <boost/preprocessor/facilities/is_empty.hpp>
00037 #include <senf/Utils/preprocessor.hh>
00038
00039
00040
00041 namespace senf {
00042 namespace log {
00043 namespace detail {
00044
00045 struct na {};
00046
00048 template <class Stream, class Area, class QueryStream=Stream, bool Query=true>
00049 struct Config
00050 {
00051 typedef typename Config<na, Area, Stream, Query>::compileLimit compileLimit;
00052 };
00053
00054 # ifndef DOXYGEN
00055
00056 template <class Area, class QueryStream, bool Query>
00057 struct Config<na, Area, QueryStream, Query>
00058 {
00059 typedef typename Config<QueryStream, na, QueryStream, Query>::compileLimit compileLimit;
00060 };
00061
00062 template <class Stream, class QueryStream, bool Query>
00063 struct Config<Stream, na, QueryStream, Query>
00064 {
00065 typedef typename Config<na, na, QueryStream, Query>::compileLimit compileLimit;
00066 };
00067
00068 template <class QueryStream, bool Query>
00069 struct Config<na, na, QueryStream, Query>
00070 {
00071 typedef typename QueryStream::compileLimit compileLimit;
00072 };
00073
00074 # endif
00075
00076 }}}
00077
00078 #define SENF_LOG_CHECK_NA_
00079
00080 #define SENF_LOG_CAT(a,b) SENF_LOG_CAT_I(a,b)
00081 #define SENF_LOG_CAT_I(a,b) a ## b
00082
00083 #define SENF_LOG_IS_NA(elt) BOOST_PP_IS_EMPTY( SENF_LOG_CAT(SENF_LOG_CHECK_NA, elt) )
00084
00085 #define SENF_LOG_SEQ_TO_NAME_(s,state,elem) \
00086 BOOST_PP_IF( SENF_LOG_IS_NA(elem), senf::log::detail::na, state::elem )
00087
00088 #define SENF_LOG_SEQ_TO_NAME(seq) \
00089 BOOST_PP_SEQ_FOLD_LEFT(SENF_LOG_SEQ_TO_NAME_, , seq)
00090
00091 #define SENF_LOG_PREDECL_(s, state, elem) \
00092 namespace elem { state }
00093
00094 #define SENF_LOG_PREDECL_long(seq) \
00095 BOOST_PP_SEQ_FOLD_RIGHT( SENF_LOG_PREDECL_, \
00096 class SENF_PP_SEQ_BACK(seq);, \
00097 BOOST_PP_SEQ_POP_BACK(seq) )
00098
00099 #define SENF_LOG_PREDECL_short(seq) \
00100 BOOST_PP_IF( SENF_LOG_IS_NA( SENF_PP_SEQ_BACK(seq) ), ; , class SENF_PP_SEQ_BACK(seq); )
00101
00102 #define SENF_LOG_PREDECL(seq) \
00103 BOOST_PP_CAT(SENF_LOG_PREDECL_, \
00104 BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)),long,short))(seq)
00105
00106 #define SENF_LOG_NIL(x)
00107
00108 #define SENF_LOG_CONF_DEFINE(stream, area, level) \
00109 SENF_LOG_PREDECL(stream) \
00110 SENF_LOG_PREDECL(area) \
00111 namespace senf { namespace log { namespace detail { \
00112 template <class QueryStream> \
00113 struct Config< SENF_LOG_SEQ_TO_NAME(stream), \
00114 SENF_LOG_SEQ_TO_NAME(area), \
00115 QueryStream, \
00116 true > \
00117 { typedef senf::log::level compileLimit; }; \
00118 }}}
00119
00120 #ifdef SENF_LOG_CONF
00121
00122 # define SLC_elt(r, data, elt) \
00123 SENF_LOG_CONF_DEFINE elt
00124
00125 BOOST_PP_SEQ_FOR_EACH(SLC_elt, none, SENF_LOG_CONF)
00126
00127 # undef SLC_elt
00128
00129 #endif
00130
00131
00132
00133
00134
00135 #endif
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146