File indexing completed on 2025-01-18 09:39:20
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_LOG_DETAIL_ATTR_OUTPUT_TERMINAL_HPP_INCLUDED_
0016 #define BOOST_LOG_DETAIL_ATTR_OUTPUT_TERMINAL_HPP_INCLUDED_
0017
0018 #include <boost/mpl/bool.hpp>
0019 #include <boost/phoenix/core/actor.hpp>
0020 #include <boost/phoenix/core/meta_grammar.hpp>
0021 #include <boost/phoenix/core/environment.hpp>
0022 #include <boost/phoenix/core/terminal_fwd.hpp>
0023 #include <boost/phoenix/core/is_nullary.hpp>
0024 #include <boost/type_traits/remove_cv.hpp>
0025 #include <boost/type_traits/remove_reference.hpp>
0026 #include <boost/fusion/sequence/intrinsic/at.hpp>
0027 #include <boost/log/detail/config.hpp>
0028 #include <boost/log/detail/custom_terminal_spec.hpp>
0029 #include <boost/log/attributes/attribute_name.hpp>
0030 #include <boost/log/attributes/value_visitation.hpp>
0031 #include <boost/log/utility/functional/bind.hpp>
0032 #include <boost/log/detail/header.hpp>
0033
0034 #ifdef BOOST_HAS_PRAGMA_ONCE
0035 #pragma once
0036 #endif
0037
0038 namespace boost {
0039
0040 BOOST_LOG_OPEN_NAMESPACE
0041
0042 namespace expressions {
0043
0044 namespace aux {
0045
0046
0047 template< typename LeftT, typename T, typename FallbackPolicyT, typename ImplT >
0048 class attribute_output_terminal
0049 {
0050 private:
0051
0052 typedef attribute_output_terminal< LeftT, T, FallbackPolicyT, ImplT > this_type;
0053
0054 typedef value_visitor_invoker< T, FallbackPolicyT > visitor_invoker_type;
0055
0056 typedef ImplT impl_type;
0057
0058 public:
0059
0060 typedef void _is_boost_log_terminal;
0061
0062
0063 template< typename >
0064 struct result;
0065
0066 template< typename ThisT, typename ContextT >
0067 struct result< ThisT(ContextT) >
0068 {
0069 typedef typename remove_cv< typename remove_reference< ContextT >::type >::type context_type;
0070 typedef typename phoenix::evaluator::impl<
0071 typename LeftT::proto_base_expr&,
0072 context_type,
0073 phoenix::unused
0074 >::result_type type;
0075 };
0076
0077 private:
0078
0079 LeftT m_left;
0080
0081 const attribute_name m_name;
0082
0083 visitor_invoker_type m_visitor_invoker;
0084
0085 impl_type m_impl;
0086
0087 public:
0088
0089 attribute_output_terminal(LeftT const& left, attribute_name const& name) : m_left(left), m_name(name)
0090 {
0091 }
0092
0093
0094 attribute_output_terminal(LeftT const& left, attribute_name const& name, impl_type const& impl) : m_left(left), m_name(name), m_impl(impl)
0095 {
0096 }
0097
0098
0099 template< typename U >
0100 attribute_output_terminal(LeftT const& left, attribute_name const& name, impl_type const& impl, U const& arg) :
0101 m_left(left), m_name(name), m_visitor_invoker(arg), m_impl(impl)
0102 {
0103 }
0104
0105
0106 attribute_output_terminal(attribute_output_terminal const& that) :
0107 m_left(that.m_left), m_name(that.m_name), m_visitor_invoker(that.m_visitor_invoker), m_impl(that.m_impl)
0108 {
0109 }
0110
0111
0112 template< typename ContextT >
0113 typename result< this_type(ContextT const&) >::type operator() (ContextT const& ctx)
0114 {
0115 typedef typename result< this_type(ContextT const&) >::type result_type;
0116 result_type strm = phoenix::eval(m_left, ctx);
0117 m_visitor_invoker(m_name, fusion::at_c< 0 >(phoenix::env(ctx).args()), binder1st< impl_type&, result_type >(m_impl, strm));
0118 return strm;
0119 }
0120
0121
0122 template< typename ContextT >
0123 typename result< const this_type(ContextT const&) >::type operator() (ContextT const& ctx) const
0124 {
0125 typedef typename result< const this_type(ContextT const&) >::type result_type;
0126 result_type strm = phoenix::eval(m_left, ctx);
0127 m_visitor_invoker(m_name, fusion::at_c< 0 >(phoenix::env(ctx).args()), binder1st< impl_type const&, result_type >(m_impl, strm));
0128 return strm;
0129 }
0130
0131 BOOST_DELETED_FUNCTION(attribute_output_terminal())
0132 };
0133
0134 }
0135
0136 }
0137
0138 BOOST_LOG_CLOSE_NAMESPACE
0139
0140 #ifndef BOOST_LOG_DOXYGEN_PASS
0141
0142 namespace phoenix {
0143
0144 namespace result_of {
0145
0146 template< typename LeftT, typename T, typename FallbackPolicyT, typename ImplT >
0147 struct is_nullary< custom_terminal< boost::log::expressions::aux::attribute_output_terminal< LeftT, T, FallbackPolicyT, ImplT > > > :
0148 public mpl::false_
0149 {
0150 };
0151
0152 }
0153
0154 }
0155
0156 #endif
0157
0158 }
0159
0160 #include <boost/log/detail/footer.hpp>
0161
0162 #endif