Chris@16: /* Chris@101: * Copyright Andrey Semashev 2007 - 2015. Chris@16: * Distributed under the Boost Software License, Version 1.0. Chris@16: * (See accompanying file LICENSE_1_0.txt or copy at Chris@16: * http://www.boost.org/LICENSE_1_0.txt) Chris@16: */ Chris@16: /*! Chris@16: * \file sources/features.hpp Chris@16: * \author Andrey Semashev Chris@16: * \date 17.07.2009 Chris@16: * Chris@16: * The header contains definition of a features list class template. Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_LOG_SOURCES_FEATURES_HPP_INCLUDED_ Chris@16: #define BOOST_LOG_SOURCES_FEATURES_HPP_INCLUDED_ Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #ifdef BOOST_HAS_PRAGMA_ONCE Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) Chris@16: Chris@16: #include Chris@101: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: //! The macro defines the maximum number of features that can be specified for a logger Chris@16: #ifndef BOOST_LOG_FEATURES_LIMIT Chris@16: #define BOOST_LOG_FEATURES_LIMIT 10 Chris@16: #endif // BOOST_LOG_FEATURES_LIMIT Chris@16: Chris@16: #endif Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: BOOST_LOG_OPEN_NAMESPACE Chris@16: Chris@16: namespace sources { Chris@16: Chris@16: #if defined(BOOST_LOG_DOXYGEN_PASS) || !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) Chris@16: Chris@16: /*! Chris@16: * \brief A type sequence of logger features Chris@16: * Chris@16: * This class template can be used to specify logger features in a \c basic_composite_logger instantiation. Chris@16: */ Chris@16: template< typename... FeaturesT > Chris@16: struct features Chris@16: { Chris@16: }; Chris@16: Chris@16: namespace aux { Chris@16: Chris@16: //! The metafunction produces the inherited features hierarchy with \c RootT as the ultimate base type Chris@16: template< typename RootT, typename FeaturesT > Chris@16: struct inherit_features; Chris@16: Chris@16: template< typename RootT, typename FeatureT0, typename... FeaturesT > Chris@16: struct inherit_features< RootT, features< FeatureT0, FeaturesT... > > Chris@16: { Chris@16: typedef typename mpl::lambda< Chris@16: FeatureT0 Chris@16: >::type::BOOST_NESTED_TEMPLATE apply< Chris@16: typename inherit_features< Chris@16: RootT, Chris@16: features< FeaturesT... > Chris@16: >::type Chris@16: >::type type; Chris@16: }; Chris@16: Chris@16: template< typename RootT, typename FeatureT0 > Chris@16: struct inherit_features< RootT, features< FeatureT0 > > Chris@16: { Chris@16: typedef typename mpl::lambda< Chris@16: FeatureT0 Chris@16: >::type::BOOST_NESTED_TEMPLATE apply< Chris@16: RootT Chris@16: >::type type; Chris@16: }; Chris@16: Chris@16: template< typename RootT > Chris@16: struct inherit_features< RootT, features< > > Chris@16: { Chris@16: typedef RootT type; Chris@16: }; Chris@16: Chris@16: } // namespace aux Chris@16: Chris@16: #else Chris@16: Chris@16: //! A type sequence of logger features Chris@16: template< BOOST_PP_ENUM_BINARY_PARAMS(BOOST_LOG_FEATURES_LIMIT, typename FeatureT, = void BOOST_PP_INTERCEPT) > Chris@16: struct features Chris@16: { Chris@16: }; Chris@16: Chris@16: namespace aux { Chris@16: Chris@16: template< typename RootT, typename FeaturesT > Chris@16: struct inherit_features; Chris@16: Chris@16: template< typename RootT, BOOST_PP_ENUM_PARAMS(BOOST_LOG_FEATURES_LIMIT, typename FeatureT) > Chris@16: struct inherit_features< RootT, features< BOOST_PP_ENUM_PARAMS(BOOST_LOG_FEATURES_LIMIT, FeatureT) > > Chris@16: { Chris@16: typedef typename mpl::lambda< Chris@16: FeatureT0 Chris@16: >::type::BOOST_NESTED_TEMPLATE apply< Chris@16: typename inherit_features< Chris@16: RootT, Chris@16: features< BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_LOG_FEATURES_LIMIT, FeatureT) > Chris@16: >::type Chris@16: >::type type; Chris@16: }; Chris@16: Chris@16: template< typename RootT, typename FeatureT0 > Chris@16: struct inherit_features< RootT, features< FeatureT0, BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_LOG_FEATURES_LIMIT, void BOOST_PP_INTERCEPT) > > Chris@16: { Chris@16: typedef typename mpl::lambda< Chris@16: FeatureT0 Chris@16: >::type::BOOST_NESTED_TEMPLATE apply< Chris@16: RootT Chris@16: >::type type; Chris@16: }; Chris@16: Chris@16: template< typename RootT > Chris@16: struct inherit_features< RootT, features< BOOST_PP_ENUM_PARAMS(BOOST_LOG_FEATURES_LIMIT, void BOOST_PP_INTERCEPT) > > Chris@16: { Chris@16: typedef RootT type; Chris@16: }; Chris@16: Chris@16: } // namespace aux Chris@16: Chris@16: #endif Chris@16: Chris@16: } // namespace sources Chris@16: Chris@16: BOOST_LOG_CLOSE_NAMESPACE // namespace log Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #include Chris@16: Chris@16: #endif // BOOST_LOG_SOURCES_FEATURES_HPP_INCLUDED_