]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 channel_severity_filter.hpp | |
9 | * \author Andrey Semashev | |
10 | * \date 25.11.2012 | |
11 | * | |
12 | * The header contains implementation of a minimal severity per channel filter. | |
13 | */ | |
14 | ||
15 | #ifndef BOOST_LOG_EXPRESSIONS_PREDICATES_CHANNEL_SEVERITY_FILTER_HPP_INCLUDED_ | |
16 | #define BOOST_LOG_EXPRESSIONS_PREDICATES_CHANNEL_SEVERITY_FILTER_HPP_INCLUDED_ | |
17 | ||
18 | #include <map> | |
19 | #include <memory> | |
20 | #include <utility> | |
21 | #include <boost/phoenix/core/actor.hpp> | |
22 | #include <boost/phoenix/core/terminal_fwd.hpp> | |
23 | #include <boost/phoenix/core/is_nullary.hpp> | |
24 | #include <boost/phoenix/core/environment.hpp> | |
25 | #include <boost/fusion/sequence/intrinsic/at_c.hpp> | |
26 | #include <boost/type_traits/remove_cv.hpp> | |
27 | #include <boost/type_traits/remove_reference.hpp> | |
28 | #include <boost/log/detail/config.hpp> | |
11fdf7f2 | 29 | #include <boost/log/detail/allocator_traits.hpp> |
7c673cae FG |
30 | #include <boost/log/detail/custom_terminal_spec.hpp> |
31 | #include <boost/log/attributes/attribute_name.hpp> | |
32 | #include <boost/log/attributes/fallback_policy.hpp> | |
33 | #include <boost/log/attributes/value_visitation.hpp> | |
1e59de90 | 34 | #include <boost/log/utility/use_std_allocator.hpp> |
7c673cae FG |
35 | #include <boost/log/utility/functional/logical.hpp> |
36 | #include <boost/log/expressions/attr_fwd.hpp> | |
37 | #include <boost/log/expressions/keyword_fwd.hpp> | |
38 | #include <boost/log/detail/header.hpp> | |
39 | ||
40 | #ifdef BOOST_HAS_PRAGMA_ONCE | |
41 | #pragma once | |
42 | #endif | |
43 | ||
44 | namespace boost { | |
45 | ||
46 | BOOST_LOG_OPEN_NAMESPACE | |
47 | ||
48 | namespace expressions { | |
49 | ||
50 | template< | |
51 | typename ChannelT, | |
52 | typename SeverityT, | |
53 | typename ChannelFallbackT = fallback_to_none, | |
54 | typename SeverityFallbackT = fallback_to_none, | |
55 | typename ChannelOrderT = less, | |
56 | typename SeverityCompareT = greater_equal, | |
1e59de90 | 57 | typename AllocatorT = use_std_allocator |
7c673cae FG |
58 | > |
59 | class channel_severity_filter_terminal | |
60 | { | |
61 | public: | |
62 | #ifndef BOOST_LOG_DOXYGEN_PASS | |
63 | //! Internal typedef for type categorization | |
64 | typedef void _is_boost_log_terminal; | |
65 | #endif | |
66 | ||
67 | //! Function result type | |
68 | typedef bool result_type; | |
69 | ||
70 | //! Channel attribute value type | |
71 | typedef ChannelT channel_value_type; | |
72 | //! Channel fallback policy | |
73 | typedef ChannelFallbackT channel_fallback_policy; | |
74 | //! Severity level attribute value type | |
75 | typedef SeverityT severity_value_type; | |
76 | //! Severity level fallback policy | |
77 | typedef SeverityFallbackT severity_fallback_policy; | |
78 | ||
79 | private: | |
80 | //! Channel to severity mapping type | |
81 | typedef std::map< | |
82 | channel_value_type, | |
83 | severity_value_type, | |
84 | ChannelOrderT, | |
11fdf7f2 | 85 | typename boost::log::aux::rebind_alloc< AllocatorT, std::pair< const channel_value_type, severity_value_type > >::type |
7c673cae FG |
86 | > mapping_type; |
87 | //! Attribute value visitor invoker for channel | |
88 | typedef value_visitor_invoker< channel_value_type, channel_fallback_policy > channel_visitor_invoker_type; | |
89 | //! Attribute value visitor invoker for severity level | |
90 | typedef value_visitor_invoker< severity_value_type, severity_fallback_policy > severity_visitor_invoker_type; | |
91 | ||
92 | //! Channel visitor | |
93 | template< typename ArgT > | |
94 | struct channel_visitor | |
95 | { | |
96 | typedef void result_type; | |
97 | ||
98 | channel_visitor(channel_severity_filter_terminal const& self, ArgT arg, bool& res) : m_self(self), m_arg(arg), m_res(res) | |
99 | { | |
100 | } | |
101 | ||
102 | result_type operator() (channel_value_type const& channel) const | |
103 | { | |
104 | m_self.visit_channel(channel, m_arg, m_res); | |
105 | } | |
106 | ||
107 | private: | |
108 | channel_severity_filter_terminal const& m_self; | |
109 | ArgT m_arg; | |
110 | bool& m_res; | |
111 | }; | |
112 | ||
113 | //! Severity level visitor | |
114 | struct severity_visitor | |
115 | { | |
116 | typedef void result_type; | |
117 | ||
118 | severity_visitor(channel_severity_filter_terminal const& self, severity_value_type const& severity, bool& res) : m_self(self), m_severity(severity), m_res(res) | |
119 | { | |
120 | } | |
121 | ||
122 | result_type operator() (severity_value_type const& severity) const | |
123 | { | |
124 | m_self.visit_severity(severity, m_severity, m_res); | |
125 | } | |
126 | ||
127 | private: | |
128 | channel_severity_filter_terminal const& m_self; | |
129 | severity_value_type const& m_severity; | |
130 | bool& m_res; | |
131 | }; | |
132 | ||
133 | private: | |
134 | //! Channel attribute name | |
135 | attribute_name m_channel_name; | |
136 | //! Severity level attribute name | |
137 | attribute_name m_severity_name; | |
138 | //! Channel value visitor invoker | |
139 | channel_visitor_invoker_type m_channel_visitor_invoker; | |
140 | //! Severity level value visitor invoker | |
141 | severity_visitor_invoker_type m_severity_visitor_invoker; | |
142 | ||
143 | //! Channel to severity level mapping | |
144 | mapping_type m_mapping; | |
145 | //! Severity checking predicate | |
146 | SeverityCompareT m_severity_compare; | |
147 | ||
148 | //! Default result | |
149 | bool m_default; | |
150 | ||
151 | public: | |
152 | //! Initializing constructor | |
153 | channel_severity_filter_terminal | |
154 | ( | |
155 | attribute_name const& channel_name, | |
156 | attribute_name const& severity_name, | |
157 | channel_fallback_policy const& channel_fallback = channel_fallback_policy(), | |
158 | severity_fallback_policy const& severity_fallback = severity_fallback_policy(), | |
159 | ChannelOrderT const& channel_order = ChannelOrderT(), | |
160 | SeverityCompareT const& severity_compare = SeverityCompareT() | |
161 | ) : | |
162 | m_channel_name(channel_name), | |
163 | m_severity_name(severity_name), | |
164 | m_channel_visitor_invoker(channel_fallback), | |
165 | m_severity_visitor_invoker(severity_fallback), | |
166 | m_mapping(channel_order), | |
167 | m_severity_compare(severity_compare), | |
168 | m_default(false) | |
169 | { | |
170 | } | |
171 | ||
172 | //! Adds a new element to the mapping | |
173 | void add(channel_value_type const& channel, severity_value_type const& severity) | |
174 | { | |
175 | typedef typename mapping_type::iterator iterator; | |
176 | std::pair< iterator, bool > res = m_mapping.insert(typename mapping_type::value_type(channel, severity)); | |
177 | if (!res.second) | |
178 | res.first->second = severity; | |
179 | } | |
180 | ||
181 | //! Sets the default result of the predicate | |
182 | void set_default(bool def) | |
183 | { | |
184 | m_default = def; | |
185 | } | |
186 | ||
187 | //! Invokation operator | |
188 | template< typename ContextT > | |
189 | result_type operator() (ContextT const& ctx) const | |
190 | { | |
191 | result_type res = m_default; | |
192 | ||
193 | typedef typename remove_cv< | |
194 | typename remove_reference< typename phoenix::result_of::env< ContextT >::type >::type | |
195 | >::type env_type; | |
196 | typedef typename env_type::args_type args_type; | |
197 | typedef typename fusion::result_of::at_c< args_type, 0 >::type arg_type; | |
198 | arg_type arg = fusion::at_c< 0 >(phoenix::env(ctx).args()); | |
199 | ||
200 | m_channel_visitor_invoker(m_channel_name, arg, channel_visitor< arg_type >(*this, arg, res)); | |
201 | ||
202 | return res; | |
203 | } | |
204 | ||
205 | private: | |
206 | //! Visits channel name | |
207 | template< typename ArgT > | |
208 | void visit_channel(channel_value_type const& channel, ArgT const& arg, bool& res) const | |
209 | { | |
210 | typename mapping_type::const_iterator it = m_mapping.find(channel); | |
211 | if (it != m_mapping.end()) | |
212 | { | |
213 | m_severity_visitor_invoker(m_severity_name, arg, severity_visitor(*this, it->second, res)); | |
214 | } | |
215 | } | |
216 | ||
217 | //! Visits severity level | |
218 | void visit_severity(severity_value_type const& left, severity_value_type const& right, bool& res) const | |
219 | { | |
220 | res = m_severity_compare(left, right); | |
221 | } | |
222 | }; | |
223 | ||
224 | template< | |
225 | typename ChannelT, | |
226 | typename SeverityT, | |
227 | typename ChannelFallbackT = fallback_to_none, | |
228 | typename SeverityFallbackT = fallback_to_none, | |
229 | typename ChannelOrderT = less, | |
230 | typename SeverityCompareT = greater_equal, | |
1e59de90 | 231 | typename AllocatorT = use_std_allocator, |
7c673cae FG |
232 | template< typename > class ActorT = phoenix::actor |
233 | > | |
234 | class channel_severity_filter_actor : | |
235 | public ActorT< channel_severity_filter_terminal< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, ChannelOrderT, SeverityCompareT, AllocatorT > > | |
236 | { | |
237 | private: | |
238 | //! Self type | |
239 | typedef channel_severity_filter_actor this_type; | |
240 | ||
241 | public: | |
242 | //! Terminal type | |
243 | typedef channel_severity_filter_terminal< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, ChannelOrderT, SeverityCompareT, AllocatorT > terminal_type; | |
244 | //! Base actor type | |
245 | typedef ActorT< terminal_type > base_type; | |
246 | ||
247 | //! Channel attribute value type | |
248 | typedef typename terminal_type::channel_value_type channel_value_type; | |
249 | //! Channel fallback policy | |
250 | typedef typename terminal_type::channel_fallback_policy channel_fallback_policy; | |
251 | //! Severity level attribute value type | |
252 | typedef typename terminal_type::severity_value_type severity_value_type; | |
253 | //! Severity level fallback policy | |
254 | typedef typename terminal_type::severity_fallback_policy severity_fallback_policy; | |
255 | ||
256 | private: | |
257 | //! An auxiliary pseudo-reference to implement insertion through subscript operator | |
258 | class subscript_result | |
259 | { | |
260 | private: | |
261 | channel_severity_filter_actor& m_owner; | |
262 | channel_value_type const& m_channel; | |
263 | ||
264 | public: | |
265 | subscript_result(channel_severity_filter_actor& owner, channel_value_type const& channel) : m_owner(owner), m_channel(channel) | |
266 | { | |
267 | } | |
268 | ||
269 | void operator= (severity_value_type const& severity) | |
270 | { | |
271 | m_owner.add(m_channel, severity); | |
272 | } | |
273 | }; | |
274 | ||
275 | public: | |
276 | //! Initializing constructor | |
277 | explicit channel_severity_filter_actor(base_type const& act) : base_type(act) | |
278 | { | |
279 | } | |
280 | //! Copy constructor | |
281 | channel_severity_filter_actor(channel_severity_filter_actor const& that) : base_type(static_cast< base_type const& >(that)) | |
282 | { | |
283 | } | |
284 | ||
285 | //! Sets the default function result | |
286 | this_type& set_default(bool def) | |
287 | { | |
288 | this->proto_expr_.child0.set_default(def); | |
289 | return *this; | |
290 | } | |
291 | ||
292 | //! Adds a new element to the mapping | |
293 | this_type& add(channel_value_type const& channel, severity_value_type const& severity) | |
294 | { | |
295 | this->proto_expr_.child0.add(channel, severity); | |
296 | return *this; | |
297 | } | |
298 | ||
299 | //! Alternative interface for adding a new element to the mapping | |
300 | subscript_result operator[] (channel_value_type const& channel) | |
301 | { | |
302 | return subscript_result(*this, channel); | |
303 | } | |
304 | }; | |
305 | ||
306 | /*! | |
307 | * The function generates a filtering predicate that checks the severity levels of log records in different channels. The predicate will return \c true | |
308 | * if the record severity level is not less than the threshold for the channel the record belongs to. | |
309 | */ | |
310 | template< typename ChannelT, typename SeverityT > | |
311 | BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT > | |
312 | channel_severity_filter(attribute_name const& channel_name, attribute_name const& severity_name) | |
313 | { | |
314 | typedef channel_severity_filter_actor< ChannelT, SeverityT > result_type; | |
315 | typedef typename result_type::terminal_type terminal_type; | |
316 | typename result_type::base_type act = {{ terminal_type(channel_name, severity_name) }}; | |
317 | return result_type(act); | |
318 | } | |
319 | ||
320 | //! \overload | |
321 | template< typename SeverityT, typename ChannelDescriptorT, template< typename > class ActorT > | |
1e59de90 | 322 | BOOST_FORCEINLINE channel_severity_filter_actor< typename ChannelDescriptorT::value_type, SeverityT, fallback_to_none, fallback_to_none, less, greater_equal, use_std_allocator, ActorT > |
7c673cae FG |
323 | channel_severity_filter(attribute_keyword< ChannelDescriptorT, ActorT > const& channel_keyword, attribute_name const& severity_name) |
324 | { | |
1e59de90 | 325 | typedef channel_severity_filter_actor< typename ChannelDescriptorT::value_type, SeverityT, fallback_to_none, fallback_to_none, less, greater_equal, use_std_allocator, ActorT > result_type; |
7c673cae FG |
326 | typedef typename result_type::terminal_type terminal_type; |
327 | typename result_type::base_type act = {{ terminal_type(channel_keyword.get_name(), severity_name) }}; | |
328 | return result_type(act); | |
329 | } | |
330 | ||
331 | //! \overload | |
332 | template< typename ChannelT, typename SeverityDescriptorT, template< typename > class ActorT > | |
1e59de90 | 333 | BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, greater_equal, use_std_allocator, ActorT > |
7c673cae FG |
334 | channel_severity_filter(attribute_name const& channel_name, attribute_keyword< SeverityDescriptorT, ActorT > const& severity_keyword) |
335 | { | |
1e59de90 | 336 | typedef channel_severity_filter_actor< ChannelT, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, greater_equal, use_std_allocator, ActorT > result_type; |
7c673cae FG |
337 | typedef typename result_type::terminal_type terminal_type; |
338 | typename result_type::base_type act = {{ terminal_type(channel_name, severity_keyword.get_name()) }}; | |
339 | return result_type(act); | |
340 | } | |
341 | ||
342 | //! \overload | |
343 | template< typename ChannelDescriptorT, typename SeverityDescriptorT, template< typename > class ActorT > | |
1e59de90 | 344 | BOOST_FORCEINLINE channel_severity_filter_actor< typename ChannelDescriptorT::value_type, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, greater_equal, use_std_allocator, ActorT > |
7c673cae FG |
345 | channel_severity_filter(attribute_keyword< ChannelDescriptorT, ActorT > const& channel_keyword, attribute_keyword< SeverityDescriptorT, ActorT > const& severity_keyword) |
346 | { | |
1e59de90 | 347 | typedef channel_severity_filter_actor< typename ChannelDescriptorT::value_type, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, greater_equal, use_std_allocator, ActorT > result_type; |
7c673cae FG |
348 | typedef typename result_type::terminal_type terminal_type; |
349 | typename result_type::base_type act = {{ terminal_type(channel_keyword.get_name(), severity_keyword.get_name()) }}; | |
350 | return result_type(act); | |
351 | } | |
352 | ||
353 | //! \overload | |
354 | template< typename SeverityT, typename ChannelT, typename ChannelFallbackT, typename ChannelTagT, template< typename > class ActorT > | |
1e59de90 | 355 | BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, fallback_to_none, less, greater_equal, use_std_allocator, ActorT > |
7c673cae FG |
356 | channel_severity_filter(attribute_actor< ChannelT, ChannelFallbackT, ChannelTagT, ActorT > const& channel_placeholder, attribute_name const& severity_name) |
357 | { | |
1e59de90 | 358 | typedef channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, fallback_to_none, less, greater_equal, use_std_allocator, ActorT > result_type; |
7c673cae FG |
359 | typedef typename result_type::terminal_type terminal_type; |
360 | typename result_type::base_type act = {{ terminal_type(channel_placeholder.get_name(), severity_name, channel_placeholder.get_fallback_policy()) }}; | |
361 | return result_type(act); | |
362 | } | |
363 | ||
364 | //! \overload | |
365 | template< typename ChannelT, typename SeverityT, typename SeverityFallbackT, typename SeverityTagT, template< typename > class ActorT > | |
1e59de90 | 366 | BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, SeverityFallbackT, less, greater_equal, use_std_allocator, ActorT > |
7c673cae FG |
367 | channel_severity_filter(attribute_name const& channel_name, attribute_actor< SeverityT, SeverityFallbackT, SeverityTagT, ActorT > const& severity_placeholder) |
368 | { | |
1e59de90 | 369 | typedef channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, SeverityFallbackT, less, greater_equal, use_std_allocator, ActorT > result_type; |
7c673cae FG |
370 | typedef typename result_type::terminal_type terminal_type; |
371 | typename result_type::base_type act = {{ terminal_type(channel_name, severity_placeholder.get_name(), fallback_to_none(), severity_placeholder.get_fallback_policy()) }}; | |
372 | return result_type(act); | |
373 | } | |
374 | ||
375 | //! \overload | |
376 | template< typename ChannelT, typename ChannelFallbackT, typename ChannelTagT, typename SeverityT, typename SeverityFallbackT, typename SeverityTagT, template< typename > class ActorT > | |
1e59de90 | 377 | BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, less, greater_equal, use_std_allocator, ActorT > |
7c673cae FG |
378 | channel_severity_filter(attribute_actor< ChannelT, ChannelFallbackT, ChannelTagT, ActorT > const& channel_placeholder, attribute_actor< SeverityT, SeverityFallbackT, SeverityTagT, ActorT > const& severity_placeholder) |
379 | { | |
1e59de90 | 380 | typedef channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, less, greater_equal, use_std_allocator, ActorT > result_type; |
7c673cae FG |
381 | typedef typename result_type::terminal_type terminal_type; |
382 | typename result_type::base_type act = {{ terminal_type(channel_placeholder.get_name(), severity_placeholder.get_name(), channel_placeholder.get_fallback_policy(), severity_placeholder.get_fallback_policy()) }}; | |
383 | return result_type(act); | |
384 | } | |
385 | ||
386 | ||
387 | //! \overload | |
388 | template< typename ChannelT, typename SeverityT, typename SeverityCompareT > | |
389 | BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, fallback_to_none, less, SeverityCompareT > | |
390 | channel_severity_filter(attribute_name const& channel_name, attribute_name const& severity_name, SeverityCompareT const& severity_compare) | |
391 | { | |
392 | typedef channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, fallback_to_none, less, SeverityCompareT > result_type; | |
393 | typedef typename result_type::terminal_type terminal_type; | |
394 | typename result_type::base_type act = {{ terminal_type(channel_name, severity_name, fallback_to_none(), fallback_to_none(), less(), severity_compare) }}; | |
395 | return result_type(act); | |
396 | } | |
397 | ||
398 | //! \overload | |
399 | template< typename SeverityT, typename ChannelDescriptorT, template< typename > class ActorT, typename SeverityCompareT > | |
1e59de90 | 400 | BOOST_FORCEINLINE channel_severity_filter_actor< typename ChannelDescriptorT::value_type, SeverityT, fallback_to_none, fallback_to_none, less, SeverityCompareT, use_std_allocator, ActorT > |
7c673cae FG |
401 | channel_severity_filter(attribute_keyword< ChannelDescriptorT, ActorT > const& channel_keyword, attribute_name const& severity_name, SeverityCompareT const& severity_compare) |
402 | { | |
1e59de90 | 403 | typedef channel_severity_filter_actor< typename ChannelDescriptorT::value_type, SeverityT, fallback_to_none, fallback_to_none, less, SeverityCompareT, use_std_allocator, ActorT > result_type; |
7c673cae FG |
404 | typedef typename result_type::terminal_type terminal_type; |
405 | typename result_type::base_type act = {{ terminal_type(channel_keyword.get_name(), severity_name, fallback_to_none(), fallback_to_none(), less(), severity_compare) }}; | |
406 | return result_type(act); | |
407 | } | |
408 | ||
409 | //! \overload | |
410 | template< typename ChannelT, typename SeverityDescriptorT, template< typename > class ActorT, typename SeverityCompareT > | |
1e59de90 | 411 | BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, SeverityCompareT, use_std_allocator, ActorT > |
7c673cae FG |
412 | channel_severity_filter(attribute_name const& channel_name, attribute_keyword< SeverityDescriptorT, ActorT > const& severity_keyword, SeverityCompareT const& severity_compare) |
413 | { | |
1e59de90 | 414 | typedef channel_severity_filter_actor< ChannelT, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, SeverityCompareT, use_std_allocator, ActorT > result_type; |
7c673cae FG |
415 | typedef typename result_type::terminal_type terminal_type; |
416 | typename result_type::base_type act = {{ terminal_type(channel_name, severity_keyword.get_name(), fallback_to_none(), fallback_to_none(), less(), severity_compare) }}; | |
417 | return result_type(act); | |
418 | } | |
419 | ||
420 | //! \overload | |
421 | template< typename ChannelDescriptorT, typename SeverityDescriptorT, template< typename > class ActorT, typename SeverityCompareT > | |
1e59de90 | 422 | BOOST_FORCEINLINE channel_severity_filter_actor< typename ChannelDescriptorT::value_type, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, SeverityCompareT, use_std_allocator, ActorT > |
7c673cae FG |
423 | channel_severity_filter(attribute_keyword< ChannelDescriptorT, ActorT > const& channel_keyword, attribute_keyword< SeverityDescriptorT, ActorT > const& severity_keyword, SeverityCompareT const& severity_compare) |
424 | { | |
1e59de90 | 425 | typedef channel_severity_filter_actor< typename ChannelDescriptorT::value_type, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, SeverityCompareT, use_std_allocator, ActorT > result_type; |
7c673cae FG |
426 | typedef typename result_type::terminal_type terminal_type; |
427 | typename result_type::base_type act = {{ terminal_type(channel_keyword.get_name(), severity_keyword.get_name(), fallback_to_none(), fallback_to_none(), less(), severity_compare) }}; | |
428 | return result_type(act); | |
429 | } | |
430 | ||
431 | //! \overload | |
432 | template< typename SeverityT, typename ChannelT, typename ChannelFallbackT, typename ChannelTagT, template< typename > class ActorT, typename SeverityCompareT > | |
1e59de90 | 433 | BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, fallback_to_none, less, SeverityCompareT, use_std_allocator, ActorT > |
7c673cae FG |
434 | channel_severity_filter(attribute_actor< ChannelT, ChannelFallbackT, ChannelTagT, ActorT > const& channel_placeholder, attribute_name const& severity_name, SeverityCompareT const& severity_compare) |
435 | { | |
1e59de90 | 436 | typedef channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, fallback_to_none, less, SeverityCompareT, use_std_allocator, ActorT > result_type; |
7c673cae FG |
437 | typedef typename result_type::terminal_type terminal_type; |
438 | typename result_type::base_type act = {{ terminal_type(channel_placeholder.get_name(), severity_name, channel_placeholder.get_fallback_policy(), fallback_to_none(), less(), severity_compare) }}; | |
439 | return result_type(act); | |
440 | } | |
441 | ||
442 | //! \overload | |
443 | template< typename ChannelT, typename SeverityT, typename SeverityFallbackT, typename SeverityTagT, template< typename > class ActorT, typename SeverityCompareT > | |
1e59de90 | 444 | BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, SeverityFallbackT, less, SeverityCompareT, use_std_allocator, ActorT > |
7c673cae FG |
445 | channel_severity_filter(attribute_name const& channel_name, attribute_actor< SeverityT, SeverityFallbackT, SeverityTagT, ActorT > const& severity_placeholder, SeverityCompareT const& severity_compare) |
446 | { | |
1e59de90 | 447 | typedef channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, SeverityFallbackT, less, SeverityCompareT, use_std_allocator, ActorT > result_type; |
7c673cae FG |
448 | typedef typename result_type::terminal_type terminal_type; |
449 | typename result_type::base_type act = {{ terminal_type(channel_name, severity_placeholder.get_name(), fallback_to_none(), severity_placeholder.get_fallback_policy(), less(), severity_compare) }}; | |
450 | return result_type(act); | |
451 | } | |
452 | ||
453 | //! \overload | |
454 | template< typename ChannelT, typename ChannelFallbackT, typename ChannelTagT, typename SeverityT, typename SeverityFallbackT, typename SeverityTagT, template< typename > class ActorT, typename SeverityCompareT > | |
1e59de90 | 455 | BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, less, SeverityCompareT, use_std_allocator, ActorT > |
7c673cae FG |
456 | channel_severity_filter(attribute_actor< ChannelT, ChannelFallbackT, ChannelTagT, ActorT > const& channel_placeholder, attribute_actor< SeverityT, SeverityFallbackT, SeverityTagT, ActorT > const& severity_placeholder, SeverityCompareT const& severity_compare) |
457 | { | |
1e59de90 | 458 | typedef channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, less, SeverityCompareT, use_std_allocator, ActorT > result_type; |
7c673cae FG |
459 | typedef typename result_type::terminal_type terminal_type; |
460 | typename result_type::base_type act = {{ terminal_type(channel_placeholder.get_name(), severity_placeholder.get_name(), channel_placeholder.get_fallback_policy(), severity_placeholder.get_fallback_policy(), less(), severity_compare) }}; | |
461 | return result_type(act); | |
462 | } | |
463 | ||
464 | ||
465 | //! \overload | |
466 | template< typename ChannelT, typename SeverityT, typename SeverityCompareT, typename ChannelOrderT > | |
467 | BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT > | |
468 | channel_severity_filter(attribute_name const& channel_name, attribute_name const& severity_name, SeverityCompareT const& severity_compare, ChannelOrderT const& channel_order) | |
469 | { | |
470 | typedef channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT > result_type; | |
471 | typedef typename result_type::terminal_type terminal_type; | |
472 | typename result_type::base_type act = {{ terminal_type(channel_name, severity_name, fallback_to_none(), fallback_to_none(), channel_order, severity_compare) }}; | |
473 | return result_type(act); | |
474 | } | |
475 | ||
476 | //! \overload | |
477 | template< typename SeverityT, typename ChannelDescriptorT, template< typename > class ActorT, typename SeverityCompareT, typename ChannelOrderT > | |
1e59de90 | 478 | BOOST_FORCEINLINE channel_severity_filter_actor< typename ChannelDescriptorT::value_type, SeverityT, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT, use_std_allocator, ActorT > |
7c673cae FG |
479 | channel_severity_filter(attribute_keyword< ChannelDescriptorT, ActorT > const& channel_keyword, attribute_name const& severity_name, SeverityCompareT const& severity_compare, ChannelOrderT const& channel_order) |
480 | { | |
1e59de90 | 481 | typedef channel_severity_filter_actor< typename ChannelDescriptorT::value_type, SeverityT, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT, use_std_allocator, ActorT > result_type; |
7c673cae FG |
482 | typedef typename result_type::terminal_type terminal_type; |
483 | typename result_type::base_type act = {{ terminal_type(channel_keyword.get_name(), severity_name, fallback_to_none(), fallback_to_none(), channel_order, severity_compare) }}; | |
484 | return result_type(act); | |
485 | } | |
486 | ||
487 | //! \overload | |
488 | template< typename ChannelT, typename SeverityDescriptorT, template< typename > class ActorT, typename SeverityCompareT, typename ChannelOrderT > | |
1e59de90 | 489 | BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT, use_std_allocator, ActorT > |
7c673cae FG |
490 | channel_severity_filter(attribute_name const& channel_name, attribute_keyword< SeverityDescriptorT, ActorT > const& severity_keyword, SeverityCompareT const& severity_compare, ChannelOrderT const& channel_order) |
491 | { | |
1e59de90 | 492 | typedef channel_severity_filter_actor< ChannelT, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT, use_std_allocator, ActorT > result_type; |
7c673cae FG |
493 | typedef typename result_type::terminal_type terminal_type; |
494 | typename result_type::base_type act = {{ terminal_type(channel_name, severity_keyword.get_name(), fallback_to_none(), fallback_to_none(), channel_order, severity_compare) }}; | |
495 | return result_type(act); | |
496 | } | |
497 | ||
498 | //! \overload | |
499 | template< typename ChannelDescriptorT, typename SeverityDescriptorT, template< typename > class ActorT, typename SeverityCompareT, typename ChannelOrderT > | |
1e59de90 | 500 | BOOST_FORCEINLINE channel_severity_filter_actor< typename ChannelDescriptorT::value_type, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT, use_std_allocator, ActorT > |
7c673cae FG |
501 | channel_severity_filter(attribute_keyword< ChannelDescriptorT, ActorT > const& channel_keyword, attribute_keyword< SeverityDescriptorT, ActorT > const& severity_keyword, SeverityCompareT const& severity_compare, ChannelOrderT const& channel_order) |
502 | { | |
1e59de90 | 503 | typedef channel_severity_filter_actor< typename ChannelDescriptorT::value_type, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT, use_std_allocator, ActorT > result_type; |
7c673cae FG |
504 | typedef typename result_type::terminal_type terminal_type; |
505 | typename result_type::base_type act = {{ terminal_type(channel_keyword.get_name(), severity_keyword.get_name(), fallback_to_none(), fallback_to_none(), channel_order, severity_compare) }}; | |
506 | return result_type(act); | |
507 | } | |
508 | ||
509 | //! \overload | |
510 | template< typename SeverityT, typename ChannelT, typename ChannelFallbackT, typename ChannelTagT, template< typename > class ActorT, typename SeverityCompareT, typename ChannelOrderT > | |
1e59de90 | 511 | BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, fallback_to_none, ChannelOrderT, SeverityCompareT, use_std_allocator, ActorT > |
7c673cae FG |
512 | channel_severity_filter(attribute_actor< ChannelT, ChannelFallbackT, ChannelTagT, ActorT > const& channel_placeholder, attribute_name const& severity_name, SeverityCompareT const& severity_compare, ChannelOrderT const& channel_order) |
513 | { | |
1e59de90 | 514 | typedef channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, fallback_to_none, ChannelOrderT, SeverityCompareT, use_std_allocator, ActorT > result_type; |
7c673cae FG |
515 | typedef typename result_type::terminal_type terminal_type; |
516 | typename result_type::base_type act = {{ terminal_type(channel_placeholder.get_name(), severity_name, channel_placeholder.get_fallback_policy(), fallback_to_none(), channel_order, severity_compare) }}; | |
517 | return result_type(act); | |
518 | } | |
519 | ||
520 | //! \overload | |
521 | template< typename ChannelT, typename SeverityT, typename SeverityFallbackT, typename SeverityTagT, template< typename > class ActorT, typename SeverityCompareT, typename ChannelOrderT > | |
1e59de90 | 522 | BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, SeverityFallbackT, ChannelOrderT, SeverityCompareT, use_std_allocator, ActorT > |
7c673cae FG |
523 | channel_severity_filter(attribute_name const& channel_name, attribute_actor< SeverityT, SeverityFallbackT, SeverityTagT, ActorT > const& severity_placeholder, SeverityCompareT const& severity_compare, ChannelOrderT const& channel_order) |
524 | { | |
1e59de90 | 525 | typedef channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, SeverityFallbackT, ChannelOrderT, SeverityCompareT, use_std_allocator, ActorT > result_type; |
7c673cae FG |
526 | typedef typename result_type::terminal_type terminal_type; |
527 | typename result_type::base_type act = {{ terminal_type(channel_name, severity_placeholder.get_name(), fallback_to_none(), severity_placeholder.get_fallback_policy(), channel_order, severity_compare) }}; | |
528 | return result_type(act); | |
529 | } | |
530 | ||
531 | //! \overload | |
532 | template< typename ChannelT, typename ChannelFallbackT, typename ChannelTagT, typename SeverityT, typename SeverityFallbackT, typename SeverityTagT, template< typename > class ActorT, typename SeverityCompareT, typename ChannelOrderT > | |
1e59de90 | 533 | BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, ChannelOrderT, SeverityCompareT, use_std_allocator, ActorT > |
7c673cae FG |
534 | channel_severity_filter(attribute_actor< ChannelT, ChannelFallbackT, ChannelTagT, ActorT > const& channel_placeholder, attribute_actor< SeverityT, SeverityFallbackT, SeverityTagT, ActorT > const& severity_placeholder, SeverityCompareT const& severity_compare, ChannelOrderT const& channel_order) |
535 | { | |
1e59de90 | 536 | typedef channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, ChannelOrderT, SeverityCompareT, use_std_allocator, ActorT > result_type; |
7c673cae FG |
537 | typedef typename result_type::terminal_type terminal_type; |
538 | typename result_type::base_type act = {{ terminal_type(channel_placeholder.get_name(), severity_placeholder.get_name(), channel_placeholder.get_fallback_policy(), severity_placeholder.get_fallback_policy(), channel_order, severity_compare) }}; | |
539 | return result_type(act); | |
540 | } | |
541 | ||
542 | } // namespace expressions | |
543 | ||
544 | BOOST_LOG_CLOSE_NAMESPACE // namespace log | |
545 | ||
546 | #ifndef BOOST_LOG_DOXYGEN_PASS | |
547 | ||
548 | namespace phoenix { | |
549 | ||
550 | namespace result_of { | |
551 | ||
552 | template< | |
553 | typename ChannelT, | |
554 | typename SeverityT, | |
555 | typename ChannelFallbackT, | |
556 | typename SeverityFallbackT, | |
557 | typename ChannelOrderT, | |
558 | typename SeverityCompareT, | |
559 | typename AllocatorT | |
560 | > | |
561 | struct is_nullary< custom_terminal< boost::log::expressions::channel_severity_filter_terminal< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, ChannelOrderT, SeverityCompareT, AllocatorT > > > : | |
562 | public mpl::false_ | |
563 | { | |
564 | }; | |
565 | ||
566 | } // namespace result_of | |
567 | ||
568 | } // namespace phoenix | |
569 | ||
570 | #endif | |
571 | ||
572 | } // namespace boost | |
573 | ||
574 | #include <boost/log/detail/footer.hpp> | |
575 | ||
576 | #endif // BOOST_LOG_EXPRESSIONS_PREDICATES_CHANNEL_SEVERITY_FILTER_HPP_INCLUDED_ |