2 * Copyright Andrey Semashev 2007 - 2015.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
8 * \file basic_sink_backend.hpp
9 * \author Andrey Semashev
12 * The header contains implementation of base classes for sink backends.
15 #ifndef BOOST_LOG_SINKS_BASIC_SINK_BACKEND_HPP_INCLUDED_
16 #define BOOST_LOG_SINKS_BASIC_SINK_BACKEND_HPP_INCLUDED_
19 #include <boost/type_traits/is_same.hpp>
20 #include <boost/log/detail/config.hpp>
21 #include <boost/log/sinks/frontend_requirements.hpp>
22 #include <boost/log/core/record_view.hpp>
23 #include <boost/log/attributes/attribute_value_set.hpp>
24 #include <boost/log/detail/header.hpp>
26 #ifdef BOOST_HAS_PRAGMA_ONCE
32 BOOST_LOG_OPEN_NAMESPACE
37 * \brief Base class for a logging sink backend
39 * The \c basic_sink_backend class template defines a number of types that
40 * all sink backends are required to define. All sink backends have to derive from the class.
42 template< typename FrontendRequirementsT >
43 struct basic_sink_backend
45 //! Frontend requirements tag
46 typedef FrontendRequirementsT frontend_requirements;
48 BOOST_DEFAULTED_FUNCTION(basic_sink_backend(), {})
50 BOOST_DELETED_FUNCTION(basic_sink_backend(basic_sink_backend const&))
51 BOOST_DELETED_FUNCTION(basic_sink_backend& operator= (basic_sink_backend const&))
55 * \brief A base class for a logging sink backend with message formatting support
57 * The \c basic_formatted_sink_backend class template indicates to the frontend that
58 * the backend requires logging record formatting.
60 * The class allows to request encoding conversion in case if the sink backend
61 * requires the formatted string in some particular encoding (e.g. if underlying API
62 * supports only narrow or wide characters). In order to perform conversion one
63 * should specify the desired final character type in the \c TargetCharT template
68 typename FrontendRequirementsT = synchronized_feeding
70 struct basic_formatted_sink_backend :
71 public basic_sink_backend<
72 typename combine_requirements< FrontendRequirementsT, formatted_records >::type
76 typedef basic_sink_backend<
77 typename combine_requirements< FrontendRequirementsT, formatted_records >::type
82 typedef CharT char_type;
83 //! Formatted string type
84 typedef std::basic_string< char_type > string_type;
85 //! Frontend requirements
86 typedef typename base_type::frontend_requirements frontend_requirements;
91 BOOST_LOG_CLOSE_NAMESPACE // namespace log
95 #include <boost/log/detail/footer.hpp>
97 #endif // BOOST_LOG_SINKS_BASIC_SINK_BACKEND_HPP_INCLUDED_