2 * Copyright Andrey Semashev 2007 - 2015.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
8 * \file sources/features.hpp
9 * \author Andrey Semashev
12 * The header contains definition of a features list class template.
15 #ifndef BOOST_LOG_SOURCES_FEATURES_HPP_INCLUDED_
16 #define BOOST_LOG_SOURCES_FEATURES_HPP_INCLUDED_
18 #include <boost/mpl/lambda.hpp>
19 #include <boost/log/detail/config.hpp>
21 #ifdef BOOST_HAS_PRAGMA_ONCE
25 #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
27 #include <boost/preprocessor/repetition/enum_params.hpp>
28 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
29 #include <boost/preprocessor/repetition/enum_shifted_params.hpp>
30 #include <boost/preprocessor/facilities/intercept.hpp>
32 //! The macro defines the maximum number of features that can be specified for a logger
33 #ifndef BOOST_LOG_FEATURES_LIMIT
34 #define BOOST_LOG_FEATURES_LIMIT 10
35 #endif // BOOST_LOG_FEATURES_LIMIT
39 #include <boost/log/detail/header.hpp>
43 BOOST_LOG_OPEN_NAMESPACE
47 #if defined(BOOST_LOG_DOXYGEN_PASS) || !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
50 * \brief A type sequence of logger features
52 * This class template can be used to specify logger features in a \c basic_composite_logger instantiation.
54 template< typename... FeaturesT >
61 //! The metafunction produces the inherited features hierarchy with \c RootT as the ultimate base type
62 template< typename RootT, typename FeaturesT >
63 struct inherit_features;
65 template< typename RootT, typename FeatureT0, typename... FeaturesT >
66 struct inherit_features< RootT, features< FeatureT0, FeaturesT... > >
68 typedef typename mpl::lambda<
70 >::type::BOOST_NESTED_TEMPLATE apply<
71 typename inherit_features<
73 features< FeaturesT... >
78 template< typename RootT, typename FeatureT0 >
79 struct inherit_features< RootT, features< FeatureT0 > >
81 typedef typename mpl::lambda<
83 >::type::BOOST_NESTED_TEMPLATE apply<
88 template< typename RootT >
89 struct inherit_features< RootT, features< > >
98 //! A type sequence of logger features
99 template< BOOST_PP_ENUM_BINARY_PARAMS(BOOST_LOG_FEATURES_LIMIT, typename FeatureT, = void BOOST_PP_INTERCEPT) >
106 template< typename RootT, typename FeaturesT >
107 struct inherit_features;
109 template< typename RootT, BOOST_PP_ENUM_PARAMS(BOOST_LOG_FEATURES_LIMIT, typename FeatureT) >
110 struct inherit_features< RootT, features< BOOST_PP_ENUM_PARAMS(BOOST_LOG_FEATURES_LIMIT, FeatureT) > >
112 typedef typename mpl::lambda<
114 >::type::BOOST_NESTED_TEMPLATE apply<
115 typename inherit_features<
117 features< BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_LOG_FEATURES_LIMIT, FeatureT) >
122 template< typename RootT, typename FeatureT0 >
123 struct inherit_features< RootT, features< FeatureT0, BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_LOG_FEATURES_LIMIT, void BOOST_PP_INTERCEPT) > >
125 typedef typename mpl::lambda<
127 >::type::BOOST_NESTED_TEMPLATE apply<
132 template< typename RootT >
133 struct inherit_features< RootT, features< BOOST_PP_ENUM_PARAMS(BOOST_LOG_FEATURES_LIMIT, void BOOST_PP_INTERCEPT) > >
142 } // namespace sources
144 BOOST_LOG_CLOSE_NAMESPACE // namespace log
148 #include <boost/log/detail/footer.hpp>
150 #endif // BOOST_LOG_SOURCES_FEATURES_HPP_INCLUDED_