41 #ifndef PB_DS_TREE_TRACE_BASE_HPP
42 #define PB_DS_TREE_TRACE_BASE_HPP
44 #ifdef PB_DS_TREE_TRACE
53 #ifdef PB_DS_TREE_TRACE
55 #define PB_DS_CLASS_T_DEC \
56 template<typename Node_CItr, typename Node_Itr, \
57 typename Cmp_Fn, bool Node_Based, typename _Alloc>
59 #define PB_DS_CLASS_C_DEC \
60 tree_trace_base<Node_CItr, Node_Itr, Cmp_Fn, \
63 #define PB_DS_TRACE_BASE \
64 branch_policy<Node_CItr, Node_Itr, _Alloc>
67 template<
typename Node_CItr,
typename Node_Itr,
68 typename Cmp_Fn,
bool Node_Based,
typename _Alloc>
69 class tree_trace_base :
private PB_DS_TRACE_BASE
76 typedef PB_DS_TRACE_BASE base_type;
77 typedef Node_CItr node_const_iterator;
78 typedef typename _Alloc::size_type size_type;
81 trace_node(node_const_iterator, size_type)
const;
86 virtual node_const_iterator
87 node_begin()
const = 0;
89 virtual node_const_iterator
93 print_node_pointer(Node_CItr, integral_constant<int,true>);
96 print_node_pointer(Node_CItr, integral_constant<int,false>);
98 template<
typename Metadata_>
100 trace_it_metadata(Node_CItr, type_to_type<Metadata_>);
103 trace_it_metadata(Node_CItr, type_to_type<null_type>);
113 trace_node(node_begin(), 0);
119 trace_node(node_const_iterator nd_it, size_type level)
const
121 if (nd_it.get_r_child() != node_end())
122 trace_node(nd_it.get_r_child(), level + 1);
124 for (size_type i = 0; i < level; ++i)
127 print_node_pointer(nd_it, integral_constant<int,Node_Based>());
128 std::cerr << base_type::extract_key(*(*nd_it));
130 typedef type_to_type<typename node_const_iterator::metadata_type>
133 trace_it_metadata(nd_it, m_type_ind_t());
135 std::cerr << std::endl;
137 if (nd_it.get_l_child() != node_end())
138 trace_node(nd_it.get_l_child(), level + 1);
142 template<
typename Metadata_>
145 trace_it_metadata(Node_CItr nd_it, type_to_type<Metadata_>)
147 const unsigned long ul =
static_cast<unsigned long>(nd_it.get_metadata());
148 std::cerr <<
" (" << ul <<
") ";
154 trace_it_metadata(Node_CItr, type_to_type<null_type>)
160 print_node_pointer(Node_CItr nd_it, integral_constant<int,true>)
161 { std::cerr << nd_it.m_p_nd <<
" "; }
166 print_node_pointer(Node_CItr nd_it, integral_constant<int,false>)
167 { std::cerr << *nd_it <<
" "; }
169 #undef PB_DS_CLASS_T_DEC
170 #undef PB_DS_CLASS_C_DEC
171 #undef PB_DS_TRACE_BASE
172 #endif // #ifdef PB_DS_TREE_TRACE
177 #endif // #ifdef PB_DS_TREE_TRACE
179 #endif // #ifndef PB_DS_TREE_TRACE_BASE_HPP
GNU extensions for policy-based data structures for public use.