Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:39:20

0001 /*
0002  *          Copyright Andrey Semashev 2007 - 2015.
0003  * Distributed under the Boost Software License, Version 1.0.
0004  *    (See accompanying file LICENSE_1_0.txt or copy at
0005  *          http://www.boost.org/LICENSE_1_0.txt)
0006  */
0007 /*!
0008  * \file   attr_output_impl.hpp
0009  * \author Andrey Semashev
0010  * \date   12.08.2012
0011  *
0012  * \brief  This header is the Boost.Log library implementation, see the library documentation
0013  *         at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
0014  */
0015 
0016 #ifndef BOOST_LOG_DETAIL_ATTR_OUTPUT_IMPL_HPP_INCLUDED_
0017 #define BOOST_LOG_DETAIL_ATTR_OUTPUT_IMPL_HPP_INCLUDED_
0018 
0019 #include <boost/mpl/is_sequence.hpp>
0020 #include <boost/phoenix/core/actor.hpp>
0021 #include <boost/log/detail/config.hpp>
0022 #include <boost/log/expressions/attr.hpp>
0023 #include <boost/log/utility/functional/bind_to_log.hpp>
0024 #include <boost/log/detail/attr_output_terminal.hpp>
0025 #include <boost/log/detail/header.hpp>
0026 
0027 #ifdef BOOST_HAS_PRAGMA_ONCE
0028 #pragma once
0029 #endif
0030 
0031 namespace boost {
0032 
0033 BOOST_LOG_OPEN_NAMESPACE
0034 
0035 namespace expressions {
0036 
0037 namespace aux {
0038 
0039 template< typename LeftT, typename T, typename FallbackPolicyT, typename TagT >
0040 struct make_output_expression
0041 {
0042     //! Resulting expression
0043     typedef attribute_output_terminal< LeftT, T, FallbackPolicyT, to_log_fun< TagT > > type;
0044 
0045     //! Creates the output expression
0046     template< typename RightT >
0047     static BOOST_FORCEINLINE type make(LeftT const& left, RightT const& right)
0048     {
0049         return type(left, right.get_name(), to_log_fun< TagT >(), right.get_fallback_policy());
0050     }
0051 };
0052 
0053 template< typename LeftT, typename RightT, typename ValueT = typename RightT::value_type, bool IsSequenceV = mpl::is_sequence< ValueT >::value >
0054 struct make_output_actor;
0055 
0056 template< template< typename > class ActorT, typename LeftExprT, typename RightT, typename ValueT >
0057 struct make_output_actor< ActorT< LeftExprT >, RightT, ValueT, false >
0058 {
0059     typedef make_output_expression<
0060         ActorT< LeftExprT >,
0061         ValueT,
0062         typename RightT::fallback_policy,
0063         typename RightT::tag_type
0064     > make_expression;
0065 
0066     typedef ActorT< typename make_expression::type > type;
0067 
0068     static BOOST_FORCEINLINE type make(ActorT< LeftExprT > const& left, RightT const& right)
0069     {
0070         type res = {{ make_expression::make(left, right) }};
0071         return res;
0072     }
0073 };
0074 
0075 template< template< typename > class ActorT, typename LeftExprT, typename RightT, typename ValueT >
0076 struct make_output_actor< ActorT< LeftExprT >, RightT, ValueT, true >
0077 {
0078     typedef attribute_output_terminal< ActorT< LeftExprT >, ValueT, typename RightT::fallback_policy, to_log_fun< typename RightT::tag_type > > expression_type;
0079 
0080     typedef ActorT< expression_type > type;
0081 
0082     static BOOST_FORCEINLINE type make(ActorT< LeftExprT > const& left, RightT const& right)
0083     {
0084         type res = {{ expression_type(left, right.get_name(), to_log_fun< typename RightT::tag_type >(), right.get_fallback_policy()) }};
0085         return res;
0086     }
0087 };
0088 
0089 } // namespace aux
0090 
0091 #define BOOST_LOG_AUX_OVERLOAD(left_ref, right_ref)\
0092     template< typename LeftExprT, typename T, typename FallbackPolicyT, typename TagT >\
0093     BOOST_FORCEINLINE typename aux::make_output_actor< phoenix::actor< LeftExprT >, attribute_actor< T, FallbackPolicyT, TagT, phoenix::actor > >::type\
0094     operator<< (phoenix::actor< LeftExprT > left_ref left, attribute_actor< T, FallbackPolicyT, TagT, phoenix::actor > right_ref right)\
0095     {\
0096         return aux::make_output_actor< phoenix::actor< LeftExprT >, attribute_actor< T, FallbackPolicyT, TagT, phoenix::actor > >::make(left, right);\
0097     }
0098 
0099 #include <boost/log/detail/generate_overloads.hpp>
0100 
0101 #undef BOOST_LOG_AUX_OVERLOAD
0102 
0103 } // namespace expressions
0104 
0105 BOOST_LOG_CLOSE_NAMESPACE // namespace log
0106 
0107 } // namespace boost
0108 
0109 #include <boost/log/detail/footer.hpp>
0110 
0111 #endif // BOOST_LOG_DETAIL_ATTR_OUTPUT_IMPL_HPP_INCLUDED_