channel_severity_filter.hpp 31 KB

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