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 enqueued_record.hpp
9 * \author Andrey Semashev
12 * \brief This header is the Boost.Log library implementation, see the library documentation
13 * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html. In this file
14 * internal configuration macros are defined.
17 #ifndef BOOST_LOG_DETAIL_ENQUEUED_RECORD_HPP_INCLUDED_
18 #define BOOST_LOG_DETAIL_ENQUEUED_RECORD_HPP_INCLUDED_
20 #include <boost/move/core.hpp>
21 #include <boost/move/utility_core.hpp>
22 #include <boost/log/detail/config.hpp>
23 #include <boost/log/detail/timestamp.hpp>
24 #include <boost/log/core/record_view.hpp>
25 #include <boost/log/detail/header.hpp>
27 #ifdef BOOST_HAS_PRAGMA_ONCE
33 BOOST_LOG_OPEN_NAMESPACE
39 //! Log record with enqueueing timestamp
42 BOOST_COPYABLE_AND_MOVABLE(enqueued_record)
45 //! Ordering predicate
46 template< typename OrderT >
50 typedef typename OrderT::result_type result_type;
53 order(order const& that) : OrderT(static_cast< OrderT const& >(that)) {}
54 order(OrderT const& that) : OrderT(that) {}
56 result_type operator() (enqueued_record const& left, enqueued_record const& right) const
58 // std::priority_queue requires ordering with semantics of std::greater, so we swap arguments
59 return OrderT::operator() (right.m_record, left.m_record);
63 boost::log::aux::timestamp m_timestamp;
66 enqueued_record(enqueued_record const& that) : m_timestamp(that.m_timestamp), m_record(that.m_record)
69 enqueued_record(BOOST_RV_REF(enqueued_record) that) :
70 m_timestamp(that.m_timestamp),
71 m_record(boost::move(that.m_record))
74 explicit enqueued_record(record_view const& rec) :
75 m_timestamp(boost::log::aux::get_timestamp()),
79 enqueued_record& operator= (BOOST_COPY_ASSIGN_REF(enqueued_record) that)
81 m_timestamp = that.m_timestamp;
82 m_record = that.m_record;
85 enqueued_record& operator= (BOOST_RV_REF(enqueued_record) that)
87 m_timestamp = that.m_timestamp;
88 m_record = boost::move(that.m_record);
97 BOOST_LOG_CLOSE_NAMESPACE // namespace log
101 #include <boost/log/detail/footer.hpp>
103 #endif // BOOST_LOG_DETAIL_ENQUEUED_RECORD_HPP_INCLUDED_