Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86659 - in branches/release: boost/log boost/log/core libs/log libs/log/doc libs/log/example/doc libs/log/src libs/log/test/run
From: andrey.semashev_at_[hidden]
Date: 2013-11-12 14:46:37


Author: andysem
Date: 2013-11-12 14:46:37 EST (Tue, 12 Nov 2013)
New Revision: 86659
URL: http://svn.boost.org/trac/boost/changeset/86659

Log:
Merged recent changes from trunk

Added:
   branches/release/libs/log/test/run/util_manip_add_value.cpp
      - copied unchanged from r86658, trunk/libs/log/test/run/util_manip_add_value.cpp
Properties modified:
   branches/release/boost/log/ (props changed)
   branches/release/libs/log/ (props changed)
Text files modified:
   branches/release/boost/log/core/record.hpp | 11 ++++
   branches/release/boost/log/core/record_view.hpp | 11 ++++
   branches/release/libs/log/doc/changelog.qbk | 10 ++++
   branches/release/libs/log/example/doc/extension_formatter_parser.cpp | 4
   branches/release/libs/log/src/dump_avx2.cpp | 2
   branches/release/libs/log/test/run/util_manip_add_value.cpp | 99 ++++++++++++++++++++++++++++++++++++++++
   branches/release/libs/log/test/run/util_manip_dump.cpp | 2
   7 files changed, 135 insertions(+), 4 deletions(-)

Modified: branches/release/boost/log/core/record.hpp
==============================================================================
--- branches/release/boost/log/core/record.hpp Tue Nov 12 13:35:19 2013 (r86658)
+++ branches/release/boost/log/core/record.hpp 2013-11-12 14:46:37 EST (Tue, 12 Nov 2013) (r86659)
@@ -158,6 +158,17 @@
     /*!
      * Attribute value lookup.
      *
+ * \param name Attribute name.
+ * \return An \c attribute_value, non-empty if it is found, empty otherwise.
+ */
+ attribute_value_set::mapped_type operator[] (attribute_value_set::key_type name) const
+ {
+ return m_impl->m_attribute_values[name];
+ }
+
+ /*!
+ * Attribute value lookup.
+ *
      * \param keyword Attribute keyword.
      * \return A \c value_ref with extracted attribute value if it is found, empty \c value_ref otherwise.
      */

Modified: branches/release/boost/log/core/record_view.hpp
==============================================================================
--- branches/release/boost/log/core/record_view.hpp Tue Nov 12 13:35:19 2013 (r86658)
+++ branches/release/boost/log/core/record_view.hpp 2013-11-12 14:46:37 EST (Tue, 12 Nov 2013) (r86659)
@@ -221,6 +221,17 @@
     /*!
      * Attribute value lookup.
      *
+ * \param name Attribute name.
+ * \return An \c attribute_value, non-empty if it is found, empty otherwise.
+ */
+ attribute_value_set::mapped_type operator[] (attribute_value_set::key_type name) const
+ {
+ return m_impl->m_attribute_values[name];
+ }
+
+ /*!
+ * Attribute value lookup.
+ *
      * \param keyword Attribute keyword.
      * \return A \c value_ref with extracted attribute value if it is found, empty \c value_ref otherwise.
      */

Modified: branches/release/libs/log/doc/changelog.qbk
==============================================================================
--- branches/release/libs/log/doc/changelog.qbk Tue Nov 12 13:35:19 2013 (r86658)
+++ branches/release/libs/log/doc/changelog.qbk 2013-11-12 14:46:37 EST (Tue, 12 Nov 2013) (r86659)
@@ -9,6 +9,16 @@
 
 [section:changelog Changelog]
 
+[heading 2.3, Boost 1.56]
+
+[*General changes:]
+
+* Added indexing operators with [class_log_attribute_name] arguments to [class_log_record] and [class_log_record_view]. The operators behave the same way as the similar operators of [class_log_attribute_value_set] (i.e. return an [class_log_attribute_value] identified by the name).
+
+[*Bug fixes:]
+
+* Fixed [link log.detailed.utilities.manipulators.dump `dump`] manipulator output on AVX2-enabled CPUs (e.g. Intel Haswell).
+
 [heading 2.2, Boost 1.55]
 
 [*General changes:]

Modified: branches/release/libs/log/example/doc/extension_formatter_parser.cpp
==============================================================================
--- branches/release/libs/log/example/doc/extension_formatter_parser.cpp Tue Nov 12 13:35:19 2013 (r86658)
+++ branches/release/libs/log/example/doc/extension_formatter_parser.cpp 2013-11-12 14:46:37 EST (Tue, 12 Nov 2013) (r86659)
@@ -69,7 +69,7 @@
     {
     }
 
- void operator() (logging::formatting_ostream& strm, logging::value_ref< point > const& value)
+ void operator() (logging::formatting_ostream& strm, logging::value_ref< point > const& value) const
     {
         if (value)
         {
@@ -81,7 +81,7 @@
     }
 
 private:
- boost::format m_format;
+ mutable boost::format m_format;
 };
 
 // Custom point formatter factory

Modified: branches/release/libs/log/src/dump_avx2.cpp
==============================================================================
--- branches/release/libs/log/src/dump_avx2.cpp Tue Nov 12 13:35:19 2013 (r86658)
+++ branches/release/libs/log/src/dump_avx2.cpp 2013-11-12 14:46:37 EST (Tue, 12 Nov 2013) (r86659)
@@ -205,7 +205,7 @@
             __m256i mm_input = _mm256_load_si256(reinterpret_cast< const __m256i* >(p));
             __m256i mm_output1, mm_output2, mm_output3;
             dump_pack(mm_char_10_to_a, mm_input, mm_output1, mm_output2, mm_output3);
- store_characters_x3(mm_output1, mm_output2, mm_output3, buf);
+ store_characters_x3(mm_output1, mm_output2, mm_output3, b);
         }
 
         _mm256_zeroall(); // need to zero all ymm registers to avoid register spills/restores the compler generates around the function call

Copied: branches/release/libs/log/test/run/util_manip_add_value.cpp (from r86658, trunk/libs/log/test/run/util_manip_add_value.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/log/test/run/util_manip_add_value.cpp 2013-11-12 14:46:37 EST (Tue, 12 Nov 2013) (r86659, copy of r86658, trunk/libs/log/test/run/util_manip_add_value.cpp)
@@ -0,0 +1,99 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2013.
+ * 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 util_manip_add_value.cpp
+ * \author Andrey Semashev
+ * \date 07.11.2013
+ *
+ * \brief This header contains tests for the \c add_value manipulator.
+ */
+
+#define BOOST_TEST_MODULE util_manip_add_value
+
+#include <iomanip>
+#include <iostream>
+#include <boost/move/core.hpp>
+#include <boost/io/ios_state.hpp>
+#include <boost/test/unit_test.hpp>
+#include <boost/log/core.hpp>
+#include <boost/log/sources/record_ostream.hpp>
+#include <boost/log/attributes/attribute_set.hpp>
+#include <boost/log/attributes/value_extraction.hpp>
+#include <boost/log/expressions/keyword.hpp>
+#include <boost/log/utility/manipulators/add_value.hpp>
+#include "make_record.hpp"
+
+namespace logging = boost::log;
+
+struct my_type
+{
+ BOOST_COPYABLE_AND_MOVABLE(my_type)
+
+public:
+ unsigned int value;
+
+ explicit my_type(unsigned int n = 0) : value(n) {}
+ my_type(my_type const& that) : value(that.value) {}
+ my_type(BOOST_RV_REF(my_type) that) : value(that.value) { that.value = 0xbaadbaad; }
+ ~my_type() { value = 0xdeaddead; }
+
+ my_type& operator= (BOOST_COPY_ASSIGN_REF(my_type) that) { value = that.value; return *this; }
+ my_type& operator= (BOOST_RV_REF(my_type) that) { value = that.value; that.value = 0xbaadbaad; return *this; }
+};
+
+inline bool operator== (my_type const& left, my_type const& right)
+{
+ return left.value == right.value;
+}
+
+inline bool operator!= (my_type const& left, my_type const& right)
+{
+ return left.value != right.value;
+}
+
+template< typename CharT, typename TraitsT >
+inline std::basic_ostream< CharT, TraitsT >& operator<< (std::basic_ostream< CharT, TraitsT >& strm, my_type const& val)
+{
+ if (strm.good())
+ {
+ boost::io::ios_flags_saver flags(strm);
+ boost::io::basic_ios_fill_saver< CharT, TraitsT > fill(strm);
+ strm << std::hex << std::internal << std::setfill(static_cast< CharT >('0')) << std::setw(10) << val.value;
+ }
+ return strm;
+}
+
+BOOST_AUTO_TEST_CASE(manual_add_attr)
+{
+ logging::record rec = make_record(logging::attribute_set());
+ BOOST_REQUIRE(!!rec);
+ logging::record_ostream strm(rec);
+
+ my_type val(0xaaaaaaaa);
+ strm << logging::add_value("MyAttr1", val) << logging::add_value("MyAttr2", my_type(0xbbbbbbbb));
+ strm.detach_from_record();
+
+ BOOST_CHECK_EQUAL(rec["MyAttr1"].extract< my_type >(), val);
+ BOOST_CHECK_EQUAL(rec["MyAttr2"].extract< my_type >(), my_type(0xbbbbbbbb));
+}
+
+BOOST_LOG_ATTRIBUTE_KEYWORD(a_my1, "MyAttr1", my_type)
+BOOST_LOG_ATTRIBUTE_KEYWORD(a_my2, "MyAttr2", my_type)
+
+BOOST_AUTO_TEST_CASE(keyword_add_attr)
+{
+ logging::record rec = make_record(logging::attribute_set());
+ BOOST_REQUIRE(!!rec);
+ logging::record_ostream strm(rec);
+
+ my_type val(0xaaaaaaaa);
+ strm << logging::add_value(a_my1, val) << logging::add_value(a_my2, my_type(0xbbbbbbbb));
+ strm.detach_from_record();
+
+ BOOST_CHECK_EQUAL(rec[a_my1], val);
+ BOOST_CHECK_EQUAL(rec[a_my2], my_type(0xbbbbbbbb));
+}

Modified: branches/release/libs/log/test/run/util_manip_dump.cpp
==============================================================================
--- branches/release/libs/log/test/run/util_manip_dump.cpp Tue Nov 12 13:35:19 2013 (r86658)
+++ branches/release/libs/log/test/run/util_manip_dump.cpp 2013-11-12 14:46:37 EST (Tue, 12 Nov 2013) (r86659)
@@ -9,7 +9,7 @@
  * \author Andrey Semashev
  * \date 09.01.2009
  *
- * \brief This header contains tests for the string literals wrapper.
+ * \brief This header contains tests for the dump manipulator.
  */
 
 #define BOOST_TEST_MODULE util_manip_dump


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk