Chris@16: /* Chris@101: * Copyright Andrey Semashev 2007 - 2015. Chris@16: * Distributed under the Boost Software License, Version 1.0. Chris@16: * (See accompanying file LICENSE_1_0.txt or copy at Chris@16: * http://www.boost.org/LICENSE_1_0.txt) Chris@16: */ Chris@16: /*! Chris@16: * \file attr_output_impl.hpp Chris@16: * \author Andrey Semashev Chris@16: * \date 12.08.2012 Chris@16: * Chris@16: * \brief This header is the Boost.Log library implementation, see the library documentation Chris@16: * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html. Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_LOG_DETAIL_ATTR_OUTPUT_IMPL_HPP_INCLUDED_ Chris@16: #define BOOST_LOG_DETAIL_ATTR_OUTPUT_IMPL_HPP_INCLUDED_ Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #ifdef BOOST_HAS_PRAGMA_ONCE Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: BOOST_LOG_OPEN_NAMESPACE Chris@16: Chris@16: namespace expressions { Chris@16: Chris@16: namespace aux { Chris@16: Chris@16: template< typename LeftT, typename T, typename FallbackPolicyT, typename TagT > Chris@16: struct make_output_expression Chris@16: { Chris@16: //! Resulting expression Chris@16: typedef attribute_output_terminal< LeftT, T, FallbackPolicyT, to_log_fun< TagT > > type; Chris@16: Chris@16: //! Creates the output expression Chris@16: template< typename RightT > Chris@16: static BOOST_FORCEINLINE type make(LeftT const& left, RightT const& right) Chris@16: { Chris@16: return type(left, right.get_name(), to_log_fun< TagT >(), right.get_fallback_policy()); Chris@16: } Chris@16: }; Chris@16: Chris@16: template< typename LeftT, typename RightT, typename ValueT = typename RightT::value_type, bool IsSequenceV = mpl::is_sequence< ValueT >::value > Chris@16: struct make_output_actor; Chris@16: Chris@16: template< template< typename > class ActorT, typename LeftExprT, typename RightT, typename ValueT > Chris@16: struct make_output_actor< ActorT< LeftExprT >, RightT, ValueT, false > Chris@16: { Chris@16: typedef make_output_expression< Chris@16: ActorT< LeftExprT >, Chris@16: ValueT, Chris@16: typename RightT::fallback_policy, Chris@16: typename RightT::tag_type Chris@16: > make_expression; Chris@16: Chris@16: typedef ActorT< typename make_expression::type > type; Chris@16: Chris@16: static BOOST_FORCEINLINE type make(ActorT< LeftExprT > const& left, RightT const& right) Chris@16: { Chris@16: type res = {{ make_expression::make(left, right) }}; Chris@16: return res; Chris@16: } Chris@16: }; Chris@16: Chris@16: template< template< typename > class ActorT, typename LeftExprT, typename RightT, typename ValueT > Chris@16: struct make_output_actor< ActorT< LeftExprT >, RightT, ValueT, true > Chris@16: { Chris@16: typedef attribute_output_terminal< ActorT< LeftExprT >, ValueT, typename RightT::fallback_policy, to_log_fun< typename RightT::tag_type > > expression_type; Chris@16: Chris@16: typedef ActorT< expression_type > type; Chris@16: Chris@16: static BOOST_FORCEINLINE type make(ActorT< LeftExprT > const& left, RightT const& right) Chris@16: { Chris@16: type res = {{ expression_type(left, right.get_name(), to_log_fun< typename RightT::tag_type >(), right.get_fallback_policy()) }}; Chris@16: return res; Chris@16: } Chris@16: }; Chris@16: Chris@16: } // namespace aux Chris@16: Chris@16: #define BOOST_LOG_AUX_OVERLOAD(left_ref, right_ref)\ Chris@16: template< typename LeftExprT, typename T, typename FallbackPolicyT, typename TagT >\ Chris@16: BOOST_FORCEINLINE typename aux::make_output_actor< phoenix::actor< LeftExprT >, attribute_actor< T, FallbackPolicyT, TagT, phoenix::actor > >::type\ Chris@16: operator<< (phoenix::actor< LeftExprT > left_ref left, attribute_actor< T, FallbackPolicyT, TagT, phoenix::actor > right_ref right)\ Chris@16: {\ Chris@16: return aux::make_output_actor< phoenix::actor< LeftExprT >, attribute_actor< T, FallbackPolicyT, TagT, phoenix::actor > >::make(left, right);\ Chris@16: } Chris@16: Chris@16: #include Chris@16: Chris@16: #undef BOOST_LOG_AUX_OVERLOAD Chris@16: Chris@16: } // namespace expressions Chris@16: Chris@16: BOOST_LOG_CLOSE_NAMESPACE // namespace log Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #include Chris@16: Chris@16: #endif // BOOST_LOG_DETAIL_ATTR_OUTPUT_IMPL_HPP_INCLUDED_