annotate DEPENDENCIES/generic/include/boost/log/detail/attr_output_terminal.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
rev   line source
Chris@16 1 /*
Chris@16 2 * Copyright Andrey Semashev 2007 - 2013.
Chris@16 3 * Distributed under the Boost Software License, Version 1.0.
Chris@16 4 * (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 5 * http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6 */
Chris@16 7 /*!
Chris@16 8 * \file attribute_output_terminal.hpp
Chris@16 9 * \author Andrey Semashev
Chris@16 10 * \date 06.11.2012
Chris@16 11 *
Chris@16 12 * The header contains implementation of a generic output manipulator in template expressions.
Chris@16 13 */
Chris@16 14
Chris@16 15 #ifndef BOOST_LOG_DETAIL_ATTR_OUTPUT_TERMINAL_HPP_INCLUDED_
Chris@16 16 #define BOOST_LOG_DETAIL_ATTR_OUTPUT_TERMINAL_HPP_INCLUDED_
Chris@16 17
Chris@16 18 #include <boost/mpl/bool.hpp>
Chris@16 19 #include <boost/phoenix/core/actor.hpp>
Chris@16 20 #include <boost/phoenix/core/meta_grammar.hpp>
Chris@16 21 #include <boost/phoenix/core/environment.hpp>
Chris@16 22 #include <boost/phoenix/core/terminal_fwd.hpp>
Chris@16 23 #include <boost/phoenix/core/is_nullary.hpp>
Chris@16 24 #include <boost/type_traits/remove_cv.hpp>
Chris@16 25 #include <boost/type_traits/remove_reference.hpp>
Chris@16 26 #include <boost/fusion/sequence/intrinsic/at.hpp>
Chris@16 27 #include <boost/log/detail/config.hpp>
Chris@16 28 #include <boost/log/detail/custom_terminal_spec.hpp>
Chris@16 29 #include <boost/log/attributes/attribute_name.hpp>
Chris@16 30 #include <boost/log/attributes/value_visitation.hpp>
Chris@16 31 #include <boost/log/utility/functional/bind.hpp>
Chris@16 32 #include <boost/log/detail/header.hpp>
Chris@16 33
Chris@16 34 #ifdef BOOST_HAS_PRAGMA_ONCE
Chris@16 35 #pragma once
Chris@16 36 #endif
Chris@16 37
Chris@16 38 namespace boost {
Chris@16 39
Chris@16 40 BOOST_LOG_OPEN_NAMESPACE
Chris@16 41
Chris@16 42 namespace expressions {
Chris@16 43
Chris@16 44 namespace aux {
Chris@16 45
Chris@16 46 //! Attribute stream output expression
Chris@16 47 template< typename LeftT, typename T, typename FallbackPolicyT, typename ImplT >
Chris@16 48 class attribute_output_terminal
Chris@16 49 {
Chris@16 50 private:
Chris@16 51 //! Self type
Chris@16 52 typedef attribute_output_terminal< LeftT, T, FallbackPolicyT, ImplT > this_type;
Chris@16 53 //! Attribute value visitor invoker
Chris@16 54 typedef value_visitor_invoker< T, FallbackPolicyT > visitor_invoker_type;
Chris@16 55 //! Manipulator implementation
Chris@16 56 typedef ImplT impl_type;
Chris@16 57
Chris@16 58 public:
Chris@16 59 //! Internal typedef for type categorization
Chris@16 60 typedef void _is_boost_log_terminal;
Chris@16 61
Chris@16 62 //! Result type definition
Chris@16 63 template< typename >
Chris@16 64 struct result;
Chris@16 65
Chris@16 66 template< typename ContextT >
Chris@16 67 struct result< this_type(ContextT) >
Chris@16 68 {
Chris@16 69 typedef typename remove_cv< typename remove_reference< ContextT >::type >::type context_type;
Chris@16 70 typedef typename phoenix::evaluator::impl<
Chris@16 71 typename LeftT::proto_base_expr&,
Chris@16 72 context_type,
Chris@16 73 phoenix::unused
Chris@16 74 >::result_type type;
Chris@16 75 };
Chris@16 76
Chris@16 77 template< typename ContextT >
Chris@16 78 struct result< const this_type(ContextT) >
Chris@16 79 {
Chris@16 80 typedef typename remove_cv< typename remove_reference< ContextT >::type >::type context_type;
Chris@16 81 typedef typename phoenix::evaluator::impl<
Chris@16 82 typename LeftT::proto_base_expr const&,
Chris@16 83 context_type,
Chris@16 84 phoenix::unused
Chris@16 85 >::result_type type;
Chris@16 86 };
Chris@16 87
Chris@16 88 private:
Chris@16 89 //! Left argument actor
Chris@16 90 LeftT m_left;
Chris@16 91 //! Attribute name
Chris@16 92 const attribute_name m_name;
Chris@16 93 //! Attribute value visitor invoker
Chris@16 94 visitor_invoker_type m_visitor_invoker;
Chris@16 95 //! Manipulator implementation
Chris@16 96 impl_type m_impl;
Chris@16 97
Chris@16 98 public:
Chris@16 99 //! Initializing constructor
Chris@16 100 attribute_output_terminal(LeftT const& left, attribute_name const& name) : m_left(left), m_name(name)
Chris@16 101 {
Chris@16 102 }
Chris@16 103
Chris@16 104 //! Initializing constructor
Chris@16 105 attribute_output_terminal(LeftT const& left, attribute_name const& name, impl_type const& impl) : m_left(left), m_name(name), m_impl(impl)
Chris@16 106 {
Chris@16 107 }
Chris@16 108
Chris@16 109 //! Initializing constructor
Chris@16 110 template< typename U >
Chris@16 111 attribute_output_terminal(LeftT const& left, attribute_name const& name, impl_type const& impl, U const& arg) :
Chris@16 112 m_left(left), m_name(name), m_visitor_invoker(arg), m_impl(impl)
Chris@16 113 {
Chris@16 114 }
Chris@16 115
Chris@16 116 //! Copy constructor
Chris@16 117 attribute_output_terminal(attribute_output_terminal const& that) :
Chris@16 118 m_left(that.m_left), m_name(that.m_name), m_visitor_invoker(that.m_visitor_invoker), m_impl(that.m_impl)
Chris@16 119 {
Chris@16 120 }
Chris@16 121
Chris@16 122 //! Invokation operator
Chris@16 123 template< typename ContextT >
Chris@16 124 typename result< this_type(ContextT const&) >::type operator() (ContextT const& ctx)
Chris@16 125 {
Chris@16 126 typedef typename result< this_type(ContextT const&) >::type result_type;
Chris@16 127 result_type strm = phoenix::eval(m_left, ctx);
Chris@16 128 m_visitor_invoker(m_name, fusion::at_c< 0 >(phoenix::env(ctx).args()), binder1st< impl_type&, result_type >(m_impl, strm));
Chris@16 129 return strm;
Chris@16 130 }
Chris@16 131
Chris@16 132 //! Invokation operator
Chris@16 133 template< typename ContextT >
Chris@16 134 typename result< const this_type(ContextT const&) >::type operator() (ContextT const& ctx) const
Chris@16 135 {
Chris@16 136 typedef typename result< const this_type(ContextT const&) >::type result_type;
Chris@16 137 result_type strm = phoenix::eval(m_left, ctx);
Chris@16 138 m_visitor_invoker(m_name, fusion::at_c< 0 >(phoenix::env(ctx).args()), binder1st< impl_type const&, result_type >(m_impl, strm));
Chris@16 139 return strm;
Chris@16 140 }
Chris@16 141
Chris@16 142 BOOST_DELETED_FUNCTION(attribute_output_terminal())
Chris@16 143 };
Chris@16 144
Chris@16 145 } // namespace aux
Chris@16 146
Chris@16 147 } // namespace expressions
Chris@16 148
Chris@16 149 BOOST_LOG_CLOSE_NAMESPACE // namespace log
Chris@16 150
Chris@16 151 #ifndef BOOST_LOG_DOXYGEN_PASS
Chris@16 152
Chris@16 153 namespace phoenix {
Chris@16 154
Chris@16 155 namespace result_of {
Chris@16 156
Chris@16 157 template< typename LeftT, typename T, typename FallbackPolicyT, typename ImplT >
Chris@16 158 struct is_nullary< custom_terminal< boost::log::expressions::aux::attribute_output_terminal< LeftT, T, FallbackPolicyT, ImplT > > > :
Chris@16 159 public mpl::false_
Chris@16 160 {
Chris@16 161 };
Chris@16 162
Chris@16 163 } // namespace result_of
Chris@16 164
Chris@16 165 } // namespace phoenix
Chris@16 166
Chris@16 167 #endif // !defined(BOOST_LOG_DOXYGEN_PASS)
Chris@16 168
Chris@16 169 } // namespace boost
Chris@16 170
Chris@16 171 #include <boost/log/detail/footer.hpp>
Chris@16 172
Chris@16 173 #endif // BOOST_LOG_DETAIL_ATTR_OUTPUT_TERMINAL_HPP_INCLUDED_