|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52151 - sandbox/boost_docs/subprojects/DebuggerVisualizers
From: filip.konvicka_at_[hidden]
Date: 2009-04-03 07:17:59
Author: fkonvick
Date: 2009-04-03 07:17:57 EDT (Fri, 03 Apr 2009)
New Revision: 52151
URL: http://svn.boost.org/trac/boost/changeset/52151
Log:
Fixed Boost.MultiIndex for vs 1.35+
Added another shared_ptr visualizer
Added support for DateTime (posix_time::ptime, time_duration)
Updated the demo
Added:
sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__DateTime.msvc8.vis.txt (contents, props changed)
sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__MI.1_34.msvc8.vis.txt
- copied, changed from r52139, /sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__MI.msvc8.vis.txt
sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__shared_ptr.msvc8.vis.txt (contents, props changed)
sandbox/boost_docs/subprojects/DebuggerVisualizers/date_time_visualizer.hpp (contents, props changed)
Removed:
sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__MI.msvc8.vis.txt
Text files modified:
sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__MI.1_34.msvc8.vis.txt | 8 ++-
sandbox/boost_docs/subprojects/DebuggerVisualizers/demo.cpp | 12 +++++
sandbox/boost_docs/subprojects/DebuggerVisualizers/mic_visualizer.hpp | 83 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 99 insertions(+), 4 deletions(-)
Added: sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__DateTime.msvc8.vis.txt
==============================================================================
--- (empty file)
+++ sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__DateTime.msvc8.vis.txt 2009-04-03 07:17:57 EDT (Fri, 03 Apr 2009)
@@ -0,0 +1,36 @@
+;----------------------------------------
+; BOOST_VISUALIZER_START boost::date_time
+;
+; Copyright Filip Konvièka 2009. Use, modification and distribution are subject
+; to 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)
+;
+; @guid C7541090-203E-11DE-8C30-0800200C9A66
+; @platform msvc-8, msvc-9
+; @version 1.0
+; @header date_time_visualizer.hpp
+; @author Filip Konvièka
+; @email filip dot konvicka at logis dot cz
+;
+; Usage
+; =====
+;
+; Visualization must be enabled by including the header file date_time_visualizer.hpp in each translation unit.
+; The visualization is not immediate, you must use the green 'Recalculate' icon.
+;
+
+; Posix time
+boost::posix_time::ptime {
+ preview (#if ($e.is_not_a_date_time()) (#("not_a_date_time")) #else (#("ptime (expand to view)")))
+ children (#if ($e.is_not_a_date_time()) (#("not_a_date_time")) #else ([_print_ptime(*&($e)),s]))
+}
+
+; Posix time_duration
+boost::posix_time::time_duration {
+ preview (#if ($e.is_special()) (#("special")) #else (#("time_duration (expand to view)")))
+ children (#if ($e.is_special()) (#("special")) #else ([_print_time_duration(*&($e)),s]))
+}
+
+;
+; BOOST_VISUALIZER_END boost::date_time
+;--------------------------------------
Copied: sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__MI.1_34.msvc8.vis.txt (from r52139, /sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__MI.msvc8.vis.txt)
==============================================================================
--- /sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__MI.msvc8.vis.txt (original)
+++ sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__MI.1_34.msvc8.vis.txt 2009-04-03 07:17:57 EDT (Fri, 03 Apr 2009)
@@ -1,13 +1,13 @@
;----------------------------------------------------
; BOOST_VISUALIZER_START boost::multi_index_container
;
-; Copyright Filip Konvièka 2007. Use, modification and distribution are subject to
-; the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt
+; Copyright Filip Konvièka 2007 - 2009. Use, modification and distribution are subject
+; to 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)
;
; @guid CA3A7EDA-43F3-11DC-9D06-4B5856D89593
; @platform msvc-8, msvc-9
-; @version 1.0
+; @version 1.1
; @header mic_visualizer.hpp
; @author Filip Konvièka
; @email filip dot konvicka at logis dot cz
@@ -15,6 +15,8 @@
; Usage
; =====
;
+; NOTE: This version is known to work with Boost MultiIndex v. 1.34.1. For newer versions, use the other file.
+;
; Visualization must be explicitly enabled in the code for each type.
; For each multi_index_container type, you need to call
;
Deleted: sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__MI.msvc8.vis.txt
==============================================================================
--- sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__MI.msvc8.vis.txt 2009-04-03 07:17:57 EDT (Fri, 03 Apr 2009)
+++ (empty file)
@@ -1,122 +0,0 @@
-;----------------------------------------------------
-; BOOST_VISUALIZER_START boost::multi_index_container
-;
-; Copyright Filip Konvièka 2007. Use, modification and distribution are subject to
-; 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)
-;
-; @guid CA3A7EDA-43F3-11DC-9D06-4B5856D89593
-; @platform msvc-8, msvc-9
-; @version 1.0
-; @header mic_visualizer.hpp
-; @author Filip Konvièka
-; @email filip dot konvicka at logis dot cz
-;
-; Usage
-; =====
-;
-; Visualization must be explicitly enabled in the code for each type.
-; For each multi_index_container type, you need to call
-;
-; VISUALIZE_MULTI_INDEX_CONTAINER(TypeName);
-;
-; at global namespace level. The macro is defined in the accompanying header file mic_visualizer.hpp.
-;
-;
-;------------------------------------
-; boost::multi_index_container - base
-;
-; This passes control to the header_holder decoders :-)
-boost::multi_index::multi_index_container<*,*,*>{
- preview(#($c.node_count, " items (multi_index_container)"))
- children(
- #(
- data:((msvc_helpers::multi_index_helper_2<boost::multi_index::multi_index_container<$T1,$T2,$T3> >*)&$c)->header,
- original members: [$c,!]
- )
- )
-}
-;-----------------------------------------------
-; boost::multi_index_container - sequenced index
-boost::multi_index::detail::header_holder<boost::multi_index::detail::sequenced_index_node<*>,*>{
- preview(#("sequenced index"))
- children(
- #(
- #list(
- head : *(((boost::multi_index::detail::sequenced_index_node_impl*)(boost::multi_index::detail::sequenced_index_node_trampoline<$T1>*)($c.member))->next_),
- size : (($T2*)&$c)->node_count,
- next : next_
- ) : ((msvc_helpers::multi_index_helper<boost::multi_index::detail::sequenced_index_node<$T1> >*)(boost::multi_index::detail::sequenced_index_node<$T1>*)(boost::multi_index::detail::sequenced_index_node_trampoline<$T1>*)(&$e))->value
- )
- )
-}
-;---------------------------------------------------
-; boost::multi_index_container - random access index
-boost::multi_index::detail::header_holder<boost::multi_index::detail::random_access_index_node<*>,*>{
- preview(#("random access index"))
- children(
- #(
- #array(
- expr: (($T2*)&$c)->ptrs.spc.data_[$i],
- size: (($T2*)&$c)->node_count
- ) : ((msvc_helpers::multi_index_helper<boost::multi_index::detail::random_access_index_node<$T1> >*)(boost::multi_index::detail::random_access_index_node<$T1>*)(boost::multi_index::detail::random_access_index_node_trampoline<$T1>*)&$e)->value
- )
- )
-}
-;--------------------------------------------
-; boost::multi_index_container - hashed index
-boost::multi_index::detail::header_holder<boost::multi_index::detail::hashed_index_node<*>,*>{
- preview(#("hashed index - ", (($T2*)&$c)->node_count, " in ", (($T2*)&$c)->buckets.size_, " buckets"))
- children(
- #(
- #array(
- expr : (($T2*)&$c)->buckets.spc.data_[$i],
- size : (($T2*)&$c)->buckets.size_
- ) : (msvc_helpers::multi_index_helper_3<boost::multi_index::detail::hashed_index_node<$T1> >*)(void*)&$e
- )
- )
-}
-msvc_helpers::multi_index_helper_3<boost::multi_index::detail::hashed_index_node<*> >{
- preview(#if ( ((boost::multi_index::detail::hashed_index_node_impl*)&$c)->next_==((boost::multi_index::detail::hashed_index_node_impl*)&$c) )
- ; no data at all
- (#("---"))
- #else (
- #if ( ((boost::multi_index::detail::hashed_index_node_impl*)&$c)->next_->next_==((boost::multi_index::detail::hashed_index_node_impl*)&$c) ) (
- ; 1 item: preview as _value_
- #( ((msvc_helpers::multi_index_helper<boost::multi_index::detail::hashed_index_node<$T1> >*)(boost::multi_index::detail::hashed_index_node<$T1>*)(boost::multi_index::detail::hashed_index_node_trampoline<$T1>*)(((boost::multi_index::detail::hashed_index_node_impl*)&$c)->next_))->value)
- ) #else (
- ; multiple items: preview as [_value_ ...]
- #("[", ((msvc_helpers::multi_index_helper<boost::multi_index::detail::hashed_index_node<$T1> >*)(boost::multi_index::detail::hashed_index_node<$T1>*)(boost::multi_index::detail::hashed_index_node_trampoline<$T1>*)(((boost::multi_index::detail::hashed_index_node_impl*)&$c)->next_))->value, " ...]")
- )
- )
- )
- children(
- #(
- ; multiple items: view as list
- #list(
- head: ((boost::multi_index::detail::hashed_index_node_impl*)&$c)->next_,
- next: next_,
- skip: ((boost::multi_index::detail::hashed_index_node_impl*)&$c)
- ) : ((msvc_helpers::multi_index_helper<boost::multi_index::detail::hashed_index_node<$T1> >*)(boost::multi_index::detail::hashed_index_node<$T1>*)(boost::multi_index::detail::hashed_index_node_trampoline<$T1>*)(&$e))->value
- )
- )
-}
-;---------------------------------------------
-; boost::multi_index_container - ordered index
-boost::multi_index::detail::header_holder<boost::multi_index::detail::ordered_index_node<*>,*>{
- preview(#("ordered index"))
- children(
- #(
- #tree(
- head : *(boost::multi_index::detail::ordered_index_node_compressed_base*)(boost::multi_index::detail::ordered_index_node_impl*)(void*)(((boost::multi_index::detail::ordered_index_node_trampoline<$T1>*)($c.member))->parentcolor_&~1U),
- size : (($T2*)&$c)->node_count,
- left : left_,
- right : right_,
- skip : 0
- ) : ((msvc_helpers::multi_index_helper<boost::multi_index::detail::ordered_index_node<$T1> >*)(boost::multi_index::detail::ordered_index_node<$T1>*)(boost::multi_index::detail::ordered_index_node_trampoline<$T1>*)(&$e))->value
- )
- )
-}
-;
-; BOOST_VISUALIZER_END boost::multi_index_container
-;--------------------------------------------------
Added: sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__shared_ptr.msvc8.vis.txt
==============================================================================
--- (empty file)
+++ sandbox/boost_docs/subprojects/DebuggerVisualizers/boost__shared_ptr.msvc8.vis.txt 2009-04-03 07:17:57 EDT (Fri, 03 Apr 2009)
@@ -0,0 +1,27 @@
+;-----------------------------------------
+; BOOST_VISUALIZER_START boost::shared_ptr
+;
+; Copyright Filip Konvièka 2009. Use, modification and distribution are subject
+; to 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)
+;
+; @guid CF808B30-203F-11DE-8C30-0800200C9A66
+; @platform msvc-8, msvc-9
+; @version 1.0
+; @author Filip Konvièka
+; @email filip dot konvicka at logis dot cz
+;
+; Usage
+; =====
+;
+; This is a simple visualizer for shared_ptr (only shows the object or "null").
+
+; boost::shared_ptr
+boost::shared_ptr<*> {
+ preview (#if (!$e.px) (#("null")) #else (#(*$e.px, " (shared_ptr)")))
+ children (#if (!$e.px) (#("null")) #else (*$e.px))
+}
+
+;
+; BOOST_VISUALIZER_END boost::shared_ptr
+;---------------------------------------
Added: sandbox/boost_docs/subprojects/DebuggerVisualizers/date_time_visualizer.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost_docs/subprojects/DebuggerVisualizers/date_time_visualizer.hpp 2009-04-03 07:17:57 EDT (Fri, 03 Apr 2009)
@@ -0,0 +1,43 @@
+// Copyright Filip Konvièka 2007 - 2009. Use, modification and distribution are subject
+// to 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)
+
+#ifndef DATE_TIME_VISUALIZER_HPP
+#define DATE_TIME_VISUALIZER_HPP
+
+#if !defined(_DEBUG)||!defined(_MSC_VER)||(_MSC_VER<1400)
+
+// Nothing
+
+#else
+
+inline char* _print_ptime(boost::posix_time::ptime& pt) {
+ static char str[200];
+ std::string s=boost::posix_time::to_simple_string(pt);
+ strcpy(str+0, s.c_str());
+ return str+0;
+}
+
+inline char* _print_time_duration(boost::posix_time::time_duration& td) {
+ static char str[200];
+ std::string s=boost::posix_time::to_simple_string(td);
+ strcpy(str+0, s.c_str());
+ return str+0;
+}
+
+// ensure that this is called in each translation unit...
+namespace {
+ template<typename T> struct _print_ptime_helper {
+ _print_ptime_helper() {
+ boost::posix_time::ptime pt;
+ _print_ptime(pt);
+ boost::posix_time::time_duration td;
+ _print_time_duration(td);
+ }
+ };
+ typedef _print_ptime_helper<void> _print_ptime_helper_2;
+ _print_ptime_helper_2 _print_ptime_helper_2i;
+}
+
+#endif
+
Modified: sandbox/boost_docs/subprojects/DebuggerVisualizers/demo.cpp
==============================================================================
--- sandbox/boost_docs/subprojects/DebuggerVisualizers/demo.cpp (original)
+++ sandbox/boost_docs/subprojects/DebuggerVisualizers/demo.cpp 2009-04-03 07:17:57 EDT (Fri, 03 Apr 2009)
@@ -13,6 +13,8 @@
using std::wstring;
using namespace std;
+#include <boost/pool/pool_alloc.hpp>
+
struct test {
wstring x;
wstring y;
@@ -24,6 +26,7 @@
return x==other.x;
}
};
+
namespace boost {
inline std::size_t hash_value(test const& t)
{
@@ -31,7 +34,7 @@
}
}
-typedef multi_index_container<test, indexed_by<hashed_non_unique<identity<test> > > > cont;
+typedef multi_index_container<test, indexed_by<hashed_non_unique<identity<test> >, sequenced<>>/*, boost::fast_pool_allocator<test> */> cont;
VISUALIZE_MULTI_INDEX_CONTAINER(cont);
@@ -39,6 +42,13 @@
cont test_cont;
test_cont.insert(test(L"aaa"));
test_cont.insert(test(L"aaa", L"other"));
+ test_cont.insert(test(L"E", L"other"));
test_cont.insert(test(L"aac"));
+ /*
+ test_cont.push_back(test(L"aaa"));
+ test_cont.push_back(test(L"aaa", L"other"));
+ test_cont.push_back(test(L"E", L"other"));
+ test_cont.push_back(test(L"aac"));
+ */
return 0; // see screenshoxt
}
Modified: sandbox/boost_docs/subprojects/DebuggerVisualizers/mic_visualizer.hpp
==============================================================================
--- sandbox/boost_docs/subprojects/DebuggerVisualizers/mic_visualizer.hpp (original)
+++ sandbox/boost_docs/subprojects/DebuggerVisualizers/mic_visualizer.hpp 2009-04-03 07:17:57 EDT (Fri, 03 Apr 2009)
@@ -1,3 +1,7 @@
+// Copyright Filip Konvièka 2007 - 2009. Use, modification and distribution are subject
+// to 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)
+
#ifndef MIC_VISUALIZER_HPP
#define MIC_VISUALIZER_HPP
@@ -19,6 +23,83 @@
};
}
+#include <boost/version.hpp>
+
+#if ( BOOST_VERSION >= 103500 )
+
+#define __VISUALIZE_MIC_INDEX_DEF(Type) \
+ boost::multi_index::detail::multi_index_node_type< \
+ Type::value_type, \
+ Type::index_specifier_type_list, \
+ Type::allocator_type>::type
+
+/// Enables MSVC visualizers for multi_index_container Type
+#define VISUALIZE_MULTI_INDEX_CONTAINER(Type) \
+namespace msvc_helpers { \
+template<> \
+struct multi_index_helper_2<Type> { \
+ typedef __VISUALIZE_MIC_INDEX_DEF(Type) index_node_type; \
+ typedef \
+ boost::base_from_member< \
+ boost::detail::allocator::rebind_to< \
+ index_node_type::allocator_type, \
+ index_node_type \
+ >::type> \
+ base_type; \
+ typedef \
+ boost::multi_index::detail::header_holder< \
+ boost::multi_index::detail::prevent_eti< \
+ Type::allocator_type, \
+ boost::detail::allocator::rebind_to< \
+ Type::allocator_type, \
+ index_node_type \
+ >::type \
+ >::type::pointer, \
+ Type> \
+ /* boost::multi_index::detail::header_holder< */ \
+ /* index_node_type, Type> */ \
+ header_holder_type; \
+ typedef \
+ boost::multi_index::detail::multi_index_base_type< \
+ Type::value_type, \
+ Type::index_specifier_type_list, \
+ Type::allocator_type>::type \
+ index_type; \
+ struct index_type_helper : public index_type {}; \
+ /* mimic multi_index_container layout */ \
+ base_type base; \
+ header_holder_type header; \
+ index_type_helper index; \
+ unsigned int node_count; \
+ /* ensure that the debugger sees this template instance */ \
+ static void get() { \
+ multi_index_helper_2<Type> *ensure_inst=0; \
+ } \
+}; \
+template<> \
+struct multi_index_helper_3<__VISUALIZE_MIC_INDEX_DEF(Type)> { \
+ /* ensure that the debugger sees this template instance */ \
+ static void get() { \
+ multi_index_helper_3< \
+ __VISUALIZE_MIC_INDEX_DEF(Type)> *ensure_inst=0; \
+ } \
+}; \
+template<> \
+struct multi_index_helper<__VISUALIZE_MIC_INDEX_DEF(Type)> { \
+ typedef __VISUALIZE_MIC_INDEX_DEF(Type) index_node_type; \
+ /* mimic index_node_base<Type::value_type> layout */ \
+ Type::value_type value; \
+ /* ensure that the debugger sees this template instance */ \
+ static void get() { \
+ multi_index_helper<index_node_type> *ensure_inst=0; \
+ } \
+}; \
+}
+
+#else
+
+// Version for 1.34
+
#define __VISUALIZE_MIC_INDEX_DEF(Type) \
boost::multi_index::detail::multi_index_node_type< \
Type::value_type, \
@@ -82,3 +163,5 @@
#endif
+#endif
+
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