]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/log/include/boost/log/sources/features.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / log / include / boost / log / sources / features.hpp
1 /*
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)
6 */
7 /*!
8 * \file sources/features.hpp
9 * \author Andrey Semashev
10 * \date 17.07.2009
11 *
12 * The header contains definition of a features list class template.
13 */
14
15 #ifndef BOOST_LOG_SOURCES_FEATURES_HPP_INCLUDED_
16 #define BOOST_LOG_SOURCES_FEATURES_HPP_INCLUDED_
17
18 #include <boost/mpl/lambda.hpp>
19 #include <boost/log/detail/config.hpp>
20
21 #ifdef BOOST_HAS_PRAGMA_ONCE
22 #pragma once
23 #endif
24
25 #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
26
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>
31
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
36
37 #endif
38
39 #include <boost/log/detail/header.hpp>
40
41 namespace boost {
42
43 BOOST_LOG_OPEN_NAMESPACE
44
45 namespace sources {
46
47 #if defined(BOOST_LOG_DOXYGEN_PASS) || !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
48
49 /*!
50 * \brief A type sequence of logger features
51 *
52 * This class template can be used to specify logger features in a \c basic_composite_logger instantiation.
53 */
54 template< typename... FeaturesT >
55 struct features
56 {
57 };
58
59 namespace aux {
60
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;
64
65 template< typename RootT, typename FeatureT0, typename... FeaturesT >
66 struct inherit_features< RootT, features< FeatureT0, FeaturesT... > >
67 {
68 typedef typename mpl::lambda<
69 FeatureT0
70 >::type::BOOST_NESTED_TEMPLATE apply<
71 typename inherit_features<
72 RootT,
73 features< FeaturesT... >
74 >::type
75 >::type type;
76 };
77
78 template< typename RootT, typename FeatureT0 >
79 struct inherit_features< RootT, features< FeatureT0 > >
80 {
81 typedef typename mpl::lambda<
82 FeatureT0
83 >::type::BOOST_NESTED_TEMPLATE apply<
84 RootT
85 >::type type;
86 };
87
88 template< typename RootT >
89 struct inherit_features< RootT, features< > >
90 {
91 typedef RootT type;
92 };
93
94 } // namespace aux
95
96 #else
97
98 //! A type sequence of logger features
99 template< BOOST_PP_ENUM_BINARY_PARAMS(BOOST_LOG_FEATURES_LIMIT, typename FeatureT, = void BOOST_PP_INTERCEPT) >
100 struct features
101 {
102 };
103
104 namespace aux {
105
106 template< typename RootT, typename FeaturesT >
107 struct inherit_features;
108
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) > >
111 {
112 typedef typename mpl::lambda<
113 FeatureT0
114 >::type::BOOST_NESTED_TEMPLATE apply<
115 typename inherit_features<
116 RootT,
117 features< BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_LOG_FEATURES_LIMIT, FeatureT) >
118 >::type
119 >::type type;
120 };
121
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) > >
124 {
125 typedef typename mpl::lambda<
126 FeatureT0
127 >::type::BOOST_NESTED_TEMPLATE apply<
128 RootT
129 >::type type;
130 };
131
132 template< typename RootT >
133 struct inherit_features< RootT, features< BOOST_PP_ENUM_PARAMS(BOOST_LOG_FEATURES_LIMIT, void BOOST_PP_INTERCEPT) > >
134 {
135 typedef RootT type;
136 };
137
138 } // namespace aux
139
140 #endif
141
142 } // namespace sources
143
144 BOOST_LOG_CLOSE_NAMESPACE // namespace log
145
146 } // namespace boost
147
148 #include <boost/log/detail/footer.hpp>
149
150 #endif // BOOST_LOG_SOURCES_FEATURES_HPP_INCLUDED_