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 sinks/frontend_requirements.hpp Chris@16: * \author Andrey Semashev Chris@16: * \date 22.04.2007 Chris@16: * Chris@16: * The header contains definition of requirement tags that sink backend may declare Chris@16: * with regard to frontends. These requirements ensure that a backend will not Chris@16: * be used with an incompatible frontend. Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_LOG_SINKS_FRONTEND_REQUIREMENTS_HPP_INCLUDED_ Chris@16: #define BOOST_LOG_SINKS_FRONTEND_REQUIREMENTS_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: #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: #ifndef BOOST_LOG_COMBINE_REQUIREMENTS_LIMIT Chris@16: //! The macro specifies the maximum number of requirements that can be combined with the \c combine_requirements metafunction Chris@16: #define BOOST_LOG_COMBINE_REQUIREMENTS_LIMIT 5 Chris@16: #endif Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: BOOST_LOG_OPEN_NAMESPACE Chris@16: Chris@16: namespace sinks { Chris@16: Chris@16: /*! Chris@16: * The sink backend expects pre-synchronized calls, all needed synchronization is implemented Chris@16: * in the frontend (IOW, only one thread is feeding records to the backend concurrently, but Chris@16: * it is possible for several threads to write sequentially). Note that if a frontend supports Chris@16: * synchronized record feeding, it will also report capable of concurrent record feeding. Chris@16: */ Chris@16: struct synchronized_feeding {}; Chris@16: Chris@16: #if !defined(BOOST_LOG_NO_THREADS) Chris@16: Chris@16: /*! Chris@16: * The sink backend ensures all needed synchronization, it is capable to handle multithreaded calls Chris@16: */ Chris@16: struct concurrent_feeding : synchronized_feeding {}; Chris@16: Chris@16: #else // !defined(BOOST_LOG_NO_THREADS) Chris@16: Chris@16: // If multithreading is disabled, threading models become redundant Chris@16: typedef synchronized_feeding concurrent_feeding; Chris@16: Chris@16: #endif // !defined(BOOST_LOG_NO_THREADS) Chris@16: Chris@16: /*! Chris@16: * The sink backend requires the frontend to perform log record formatting before feeding Chris@16: */ Chris@16: struct formatted_records {}; Chris@16: Chris@16: /*! Chris@16: * The sink backend supports flushing Chris@16: */ Chris@16: struct flushing {}; Chris@16: Chris@16: #ifdef BOOST_LOG_DOXYGEN_PASS Chris@16: Chris@16: /*! Chris@16: * The metafunction combines multiple requirement tags into one type. The resulting type will Chris@16: * satisfy all specified requirements (i.e. \c has_requirement metafunction will return positive result). Chris@16: */ Chris@16: template< typename... RequirementsT > Chris@16: struct combine_requirements; Chris@16: Chris@16: #else Chris@16: Chris@16: template< BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_LOG_COMBINE_REQUIREMENTS_LIMIT, typename ReqT, mpl::na) > Chris@16: struct combine_requirements : Chris@16: mpl::inherit_linearly< Chris@16: mpl::vector< BOOST_PP_ENUM_PARAMS(BOOST_LOG_COMBINE_REQUIREMENTS_LIMIT, ReqT) >, Chris@16: mpl::inherit2< mpl::_1, mpl::_2 > Chris@16: > Chris@16: { Chris@16: }; Chris@16: Chris@16: #endif // BOOST_LOG_DOXYGEN_PASS Chris@16: Chris@16: /*! Chris@16: * A helper metafunction to check if a requirement is satisfied. The \c TestedT template argument Chris@16: * should be the type combining one or several requirements and \c RequiredT is the requirement Chris@16: * to test against. The metafunction will yield a positive result if \c TestedT supports \c RequiredT. Chris@16: */ Chris@16: template< typename TestedT, typename RequiredT > Chris@16: struct has_requirement : Chris@16: public is_base_of< RequiredT, TestedT > Chris@16: { Chris@16: }; Chris@16: Chris@16: } // namespace sinks 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_SINKS_FRONTEND_REQUIREMENTS_HPP_INCLUDED_