Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:39:26

0001 /*
0002  *          Copyright Andrey Semashev 2007 - 2015.
0003  * Distributed under the Boost Software License, Version 1.0.
0004  *    (See accompanying file LICENSE_1_0.txt or copy at
0005  *          http://www.boost.org/LICENSE_1_0.txt)
0006  */
0007 /*!
0008  * \file   sources/features.hpp
0009  * \author Andrey Semashev
0010  * \date   17.07.2009
0011  *
0012  * The header contains definition of a features list class template.
0013  */
0014 
0015 #ifndef BOOST_LOG_SOURCES_FEATURES_HPP_INCLUDED_
0016 #define BOOST_LOG_SOURCES_FEATURES_HPP_INCLUDED_
0017 
0018 #include <boost/mpl/lambda.hpp>
0019 #include <boost/log/detail/config.hpp>
0020 
0021 #ifdef BOOST_HAS_PRAGMA_ONCE
0022 #pragma once
0023 #endif
0024 
0025 #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
0026 
0027 #include <boost/preprocessor/repetition/enum_params.hpp>
0028 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
0029 #include <boost/preprocessor/repetition/enum_shifted_params.hpp>
0030 #include <boost/preprocessor/facilities/intercept.hpp>
0031 
0032 //! The macro defines the maximum number of features that can be specified for a logger
0033 #ifndef BOOST_LOG_FEATURES_LIMIT
0034 #define BOOST_LOG_FEATURES_LIMIT 10
0035 #endif // BOOST_LOG_FEATURES_LIMIT
0036 
0037 #endif
0038 
0039 #include <boost/log/detail/header.hpp>
0040 
0041 namespace boost {
0042 
0043 BOOST_LOG_OPEN_NAMESPACE
0044 
0045 namespace sources {
0046 
0047 #if defined(BOOST_LOG_DOXYGEN_PASS) || !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
0048 
0049 /*!
0050  * \brief A type sequence of logger features
0051  *
0052  * This class template can be used to specify logger features in a \c basic_composite_logger instantiation.
0053  */
0054 template< typename... FeaturesT >
0055 struct features
0056 {
0057 };
0058 
0059 namespace aux {
0060 
0061 //! The metafunction produces the inherited features hierarchy with \c RootT as the ultimate base type
0062 template< typename RootT, typename FeaturesT >
0063 struct inherit_features;
0064 
0065 template< typename RootT, typename FeatureT0, typename... FeaturesT >
0066 struct inherit_features< RootT, features< FeatureT0, FeaturesT... > >
0067 {
0068     typedef typename mpl::lambda<
0069         FeatureT0
0070     >::type::BOOST_NESTED_TEMPLATE apply<
0071         typename inherit_features<
0072             RootT,
0073             features< FeaturesT... >
0074         >::type
0075     >::type type;
0076 };
0077 
0078 template< typename RootT, typename FeatureT0 >
0079 struct inherit_features< RootT, features< FeatureT0 > >
0080 {
0081     typedef typename mpl::lambda<
0082         FeatureT0
0083     >::type::BOOST_NESTED_TEMPLATE apply<
0084         RootT
0085     >::type type;
0086 };
0087 
0088 template< typename RootT >
0089 struct inherit_features< RootT, features< > >
0090 {
0091     typedef RootT type;
0092 };
0093 
0094 } // namespace aux
0095 
0096 #else
0097 
0098 //! A type sequence of logger features
0099 template< BOOST_PP_ENUM_BINARY_PARAMS(BOOST_LOG_FEATURES_LIMIT, typename FeatureT, = void BOOST_PP_INTERCEPT) >
0100 struct features
0101 {
0102 };
0103 
0104 namespace aux {
0105 
0106 template< typename RootT, typename FeaturesT >
0107 struct inherit_features;
0108 
0109 template< typename RootT, BOOST_PP_ENUM_PARAMS(BOOST_LOG_FEATURES_LIMIT, typename FeatureT) >
0110 struct inherit_features< RootT, features< BOOST_PP_ENUM_PARAMS(BOOST_LOG_FEATURES_LIMIT, FeatureT) > >
0111 {
0112     typedef typename mpl::lambda<
0113         FeatureT0
0114     >::type::BOOST_NESTED_TEMPLATE apply<
0115         typename inherit_features<
0116             RootT,
0117             features< BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_LOG_FEATURES_LIMIT, FeatureT) >
0118         >::type
0119     >::type type;
0120 };
0121 
0122 template< typename RootT, typename FeatureT0 >
0123 struct inherit_features< RootT, features< FeatureT0, BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_LOG_FEATURES_LIMIT, void BOOST_PP_INTERCEPT) > >
0124 {
0125     typedef typename mpl::lambda<
0126         FeatureT0
0127     >::type::BOOST_NESTED_TEMPLATE apply<
0128         RootT
0129     >::type type;
0130 };
0131 
0132 template< typename RootT >
0133 struct inherit_features< RootT, features< BOOST_PP_ENUM_PARAMS(BOOST_LOG_FEATURES_LIMIT, void BOOST_PP_INTERCEPT) > >
0134 {
0135     typedef RootT type;
0136 };
0137 
0138 } // namespace aux
0139 
0140 #endif
0141 
0142 } // namespace sources
0143 
0144 BOOST_LOG_CLOSE_NAMESPACE // namespace log
0145 
0146 } // namespace boost
0147 
0148 #include <boost/log/detail/footer.hpp>
0149 
0150 #endif // BOOST_LOG_SOURCES_FEATURES_HPP_INCLUDED_