Boost logo

Boost Users :

From: Filip Konvička (filip.konvicka_at_[hidden])
Date: 2007-05-31 06:58:11


> There's an obvious evolution path, namely supporting the rest of
> node types. Random access should be straightforward, as elements
> can easily be traversed in a linear fashion much as you're already doing with
> sequenced nodes --so if you want some clues about that please tell me so.
> As for the other node types (ordered and hashed) traversal is not that simple,
> I guess it'd help a lot to see how the built-in visualizers for std::map and
> stdext::hash_map are doing.
>
The visualizer offers tree traversal:
  #tree(head:? size:? left:? right:? skip:?)

I tried and succeeded partially, with

boost::multi_index::detail::header_holder<boost::multi_index::detail::ordered_index_node<*>,*>{
  preview(#("multi_index_container data"))
  children(
    #(
      #tree(
            head :
; the head node
(ordered_index_node_compressed_base*)
(ordered_index_node_impl*)
(ordered_index_node_trampoline<$T1>*)
($c.member),
            size : ((multi_index_helper_3<$T2>*)&$c)->node_count,
            left : left_,
            right : right_,
; skip null nodes
            skip : 0
      ) :
; node formatting
*(multi_index_helper<ordered_index_node<$T1> >*)
  (ordered_index_node<$T1>*)
  (ordered_index_node_trampoline<$T1>*)
  (&$e)
    )
  )
}

Out of 3 items, I can see the leaf nodes (left_ and right_) correctly,
but the head node is displayed incorrectly. When I add some more items,
I still see just 2 or 3 items and the rest is garbage. Perhaps there is
something about _compressed_base which needs special treatment?

BTW, std::map is visualized by

        #tree
        (
            head : $c._Myhead->_Parent,
            skip : $c._Myhead,
            size : $c._Mysize,
            left : _Left,
            right : _Right
        ) : $e._Myval

and stdext::hash_map by

        #list
        (
            head : $c._List._Myhead->_Next,
            size : $c._List._Mysize,
            next : _Next
        ) : $e._Myval

Piece of cake :-)

Thanks,
Filip


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net