File indexing completed on 2025-01-18 09:39:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_LOG_DETAIL_UNARY_FUNCTION_TERMINAL_HPP_INCLUDED_
0016 #define BOOST_LOG_DETAIL_UNARY_FUNCTION_TERMINAL_HPP_INCLUDED_
0017
0018 #include <boost/mpl/bool.hpp>
0019 #include <boost/utility/result_of.hpp>
0020 #include <boost/fusion/sequence/intrinsic/at_c.hpp>
0021 #include <boost/phoenix/core/is_nullary.hpp>
0022 #include <boost/phoenix/core/environment.hpp>
0023 #include <boost/type_traits/remove_cv.hpp>
0024 #include <boost/type_traits/remove_reference.hpp>
0025 #include <boost/log/detail/config.hpp>
0026 #include <boost/log/detail/copy_cv.hpp>
0027 #include <boost/log/detail/custom_terminal_spec.hpp>
0028 #include <boost/log/detail/header.hpp>
0029
0030 #ifdef BOOST_HAS_PRAGMA_ONCE
0031 #pragma once
0032 #endif
0033
0034 namespace boost {
0035
0036 BOOST_LOG_OPEN_NAMESPACE
0037
0038 namespace expressions {
0039
0040 namespace aux {
0041
0042
0043
0044
0045
0046
0047
0048
0049 template< typename FunT >
0050 class unary_function_terminal
0051 {
0052 private:
0053
0054 typedef FunT function_type;
0055
0056 typedef unary_function_terminal< function_type > this_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<
0070 typename remove_reference< typename phoenix::result_of::env< ContextT >::type >::type
0071 >::type env_type;
0072 typedef typename env_type::args_type args_type;
0073 typedef typename boost::log::aux::copy_cv< ThisT, function_type >::type cv_function_type;
0074
0075 typedef typename boost::result_of< cv_function_type(typename fusion::result_of::at_c< args_type, 0 >::type) >::type type;
0076 };
0077
0078 private:
0079
0080 function_type m_fun;
0081
0082 public:
0083
0084 BOOST_DEFAULTED_FUNCTION(unary_function_terminal(), {})
0085
0086 unary_function_terminal(unary_function_terminal const& that) : m_fun(that.m_fun) {}
0087
0088 template< typename ArgT1 >
0089 explicit unary_function_terminal(ArgT1 const& arg1) : m_fun(arg1) {}
0090
0091 template< typename ArgT1, typename ArgT2 >
0092 unary_function_terminal(ArgT1 const& arg1, ArgT2 const& arg2) : m_fun(arg1, arg2) {}
0093
0094 template< typename ArgT1, typename ArgT2, typename ArgT3 >
0095 unary_function_terminal(ArgT1 const& arg1, ArgT2 const& arg2, ArgT3 const& arg3) : m_fun(arg1, arg2, arg3) {}
0096
0097
0098 template< typename ContextT >
0099 typename result< this_type(ContextT const&) >::type
0100 operator() (ContextT const& ctx)
0101 {
0102 return m_fun(fusion::at_c< 0 >(phoenix::env(ctx).args()));
0103 }
0104
0105
0106 template< typename ContextT >
0107 typename result< const this_type(ContextT const&) >::type
0108 operator() (ContextT const& ctx) const
0109 {
0110 return m_fun(fusion::at_c< 0 >(phoenix::env(ctx).args()));
0111 }
0112 };
0113
0114 }
0115
0116 }
0117
0118 BOOST_LOG_CLOSE_NAMESPACE
0119
0120 #ifndef BOOST_LOG_DOXYGEN_PASS
0121
0122 namespace phoenix {
0123
0124 namespace result_of {
0125
0126 template< typename FunT >
0127 struct is_nullary< custom_terminal< boost::log::expressions::aux::unary_function_terminal< FunT > > > :
0128 public mpl::false_
0129 {
0130 };
0131
0132 }
0133
0134 }
0135
0136 #endif
0137
0138 }
0139
0140 #include <boost/log/detail/footer.hpp>
0141
0142 #endif