41 #ifndef PB_DS_TREE_TRACE_BASE_HPP
42 #define PB_DS_TREE_TRACE_BASE_HPP
44 #ifdef PB_DS_TREE_TRACE
46 #include <ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp>
47 #include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
55 #ifdef PB_DS_TREE_TRACE
57 #define PB_DS_CLASS_T_DEC \
59 class Const_Node_Iterator, \
60 class Node_Iterator, \
65 #define PB_DS_CLASS_C_DEC \
67 Const_Node_Iterator, \
73 #define PB_DS_BASE_C_DEC \
74 basic_tree_policy_base< \
75 Const_Node_Iterator, \
79 template<
typename Const_Node_Iterator,
84 class tree_trace_base :
private PB_DS_BASE_C_DEC
91 typedef PB_DS_BASE_C_DEC base_type;
93 typedef Const_Node_Iterator const_node_iterator;
95 typedef typename Allocator::size_type size_type;
99 trace_node(const_node_iterator nd_it, size_type level)
const;
104 virtual const_node_iterator
105 node_begin()
const = 0;
107 virtual const_node_iterator
108 node_end()
const = 0;
111 print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,true>);
114 print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,false>);
116 template<
typename Metadata_>
118 trace_it_metadata(Const_Node_Iterator nd_it, type_to_type<Metadata_>);
121 trace_it_metadata(Const_Node_Iterator, type_to_type<null_node_metadata>);
132 trace_node(node_begin(), 0);
138 trace_node(const_node_iterator nd_it, size_type level)
const
140 if (nd_it.get_r_child() != node_end())
141 trace_node(nd_it.get_r_child(), level + 1);
143 for (size_type i = 0; i < level; ++i)
146 print_node_pointer(nd_it, integral_constant<int,Node_Based>());
147 std::cerr << base_type::extract_key(*(*nd_it));
151 typename const_node_iterator::metadata_type>
154 trace_it_metadata(nd_it, m_type_ind_t());
158 if (nd_it.get_l_child() != node_end())
159 trace_node(nd_it.get_l_child(), level + 1);
163 template<
typename Metadata_>
166 trace_it_metadata(Const_Node_Iterator nd_it, type_to_type<Metadata_>)
169 static_cast<unsigned long>(nd_it.get_metadata()) <<
") ";
175 trace_it_metadata(Const_Node_Iterator, type_to_type<null_node_metadata>)
181 print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,true>)
189 print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,false>)
194 #undef PB_DS_CLASS_T_DEC
196 #undef PB_DS_CLASS_C_DEC
198 #undef PB_DS_BASE_C_DEC
200 #endif // #ifdef PB_DS_TREE_TRACE
206 #endif // #ifdef PB_DS_TREE_TRACE
208 #endif // #ifndef PB_DS_TREE_TRACE_BASE_HPP
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
Write a newline and flush the stream.
ostream cerr
Linked to standard output.