/usr/include/boost/log/attributes
NameSizeModeActions
attribute.hpp52300644editdlrm
attribute_cast.hpp17800644editdlrm
attribute_name.hpp57990644editdlrm
attribute_set.hpp171400644editdlrm
attribute_value.hpp162770644editdlrm
attribute_value_impl.hpp40750644editdlrm
attribute_value_set.hpp169540644editdlrm
clock.hpp26870644editdlrm
constant.hpp35470644editdlrm
counter.hpp30720644editdlrm
current_process_id.hpp16900644editdlrm
current_process_name.hpp17030644editdlrm
current_thread_id.hpp28850644editdlrm
fallback_policy.hpp47310644editdlrm
fallback_policy_fwd.hpp13120644editdlrm
function.hpp46120644editdlrm
mutable_constant.hpp91400644editdlrm
named_scope.hpp149750644editdlrm
scoped_attribute.hpp81410644editdlrm
timer.hpp24690644editdlrm
time_traits.hpp19670644editdlrm
value_extraction.hpp349270644editdlrm
value_extraction_fwd.hpp15940644editdlrm
value_visitation.hpp136120644editdlrm
value_visitation_fwd.hpp11500644editdlrm
Edit: /usr/include/boost/log/attributes/function.hpp (4612B)
/* * Copyright Andrey Semashev 2007 - 2015. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) */ /*! * \file function.hpp * \author Andrey Semashev * \date 24.06.2007 * * The header contains implementation of an attribute that calls a third-party function on value acquisition. */ #ifndef BOOST_LOG_ATTRIBUTES_FUNCTION_HPP_INCLUDED_ #define BOOST_LOG_ATTRIBUTES_FUNCTION_HPP_INCLUDED_ #include #include #include #include #include #include #include #include #include #include #ifdef BOOST_HAS_PRAGMA_ONCE #pragma once #endif namespace boost { BOOST_LOG_OPEN_NAMESPACE namespace attributes { /*! * \brief A class of an attribute that acquires its value from a third-party function object * * The attribute calls a stored nullary function object to acquire each value. * The result type of the function object is the attribute value type. * * It is not recommended to use this class directly. Use \c make_function convenience functions * to construct the attribute instead. */ template< typename R > class function : public attribute { BOOST_STATIC_ASSERT_MSG(!is_void< R >::value, "Boost.Log: Function object return type must not be void"); public: //! The attribute value type typedef R value_type; protected: //! Base class for factory implementation class BOOST_LOG_NO_VTABLE BOOST_SYMBOL_VISIBLE impl : public attribute::impl { }; //! Factory implementation template< typename T > class impl_template : public impl { private: //! Functor that returns attribute values /*! * \note The constness signifies that the function object should avoid * modifying its state since it's not protected against concurrent calls. */ const T m_Functor; public: /*! * Constructor with the stored delegate initialization */ explicit impl_template(T const& fun) : m_Functor(fun) {} attribute_value get_value() { return attributes::make_attribute_value(m_Functor()); } }; public: /*! * Initializing constructor */ template< typename T > explicit function(T const& fun) : attribute(new impl_template< T >(fun)) { } /*! * Constructor for casting support */ explicit function(cast_source const& source) : attribute(source.as< impl >()) { } }; #ifndef BOOST_NO_RESULT_OF /*! * The function constructs \c function attribute instance with the provided function object. * * \param fun Nullary functional object that returns an actual stored value for an attribute value. * \return Pointer to the attribute instance */ template< typename T > inline function< typename remove_cv< typename remove_reference< typename boost::result_of< T() >::type >::type >::type > make_function(T const& fun) { typedef typename remove_cv< typename remove_reference< typename boost::result_of< T() >::type >::type >::type result_type; typedef function< result_type > function_type; return function_type(fun); } #endif // BOOST_NO_RESULT_OF #ifndef BOOST_LOG_DOXYGEN_PASS /*! * The function constructs \c function attribute instance with the provided function object. * Use this version if your compiler fails to determine the result type of the function object. * * \param fun Nullary functional object that returns an actual stored value for an attribute value. * \return Pointer to the attribute instance */ template< typename R, typename T > inline function< typename remove_cv< typename remove_reference< R >::type >::type > make_function(T const& fun) { typedef typename remove_cv< typename remove_reference< R >::type >::type result_type; typedef function< result_type > function_type; return function_type(fun); } #endif // BOOST_LOG_DOXYGEN_PASS } // namespace attributes BOOST_LOG_CLOSE_NAMESPACE // namespace log } // namespace boost #include #endif // BOOST_LOG_ATTRIBUTES_FUNCTOR_HPP_INCLUDED_