9 #ifndef MRPT_DIRECTED_TREE_H
10 #define MRPT_DIRECTED_TREE_H
53 template <
class TYPE_EDGES = u
int8_t>
69 TNodeID child_id_,
bool direction_child_to_parent =
false,
70 const TYPE_EDGES& edge_data = TYPE_EDGES())
71 :
id(child_id_),
reverse(direction_child_to_parent),
data(edge_data)
116 const size_t depth_level) = 0;
123 const TNodeID vroot, Visitor& user_visitor,
124 const size_t root_depth_level = 0)
const
126 const size_t next_depth_level = root_depth_level + 1;
130 const TListEdges& children = itChildren->second;
132 itEdge != children.end(); ++itEdge)
134 user_visitor.OnVisitNode(vroot, *itEdge, next_depth_level);
136 itEdge->id, user_visitor,
145 const TNodeID vroot, Visitor& user_visitor,
146 const size_t root_depth_level = 0)
const
148 const size_t next_depth_level = root_depth_level + 1;
152 const TListEdges& children = itChildren->second;
154 itEdge != children.end(); ++itEdge)
155 user_visitor.OnVisitNode(vroot, *itEdge, next_depth_level);
157 itEdge != children.end(); ++itEdge)
159 itEdge->id, user_visitor,
180 std::stringstream& m_s;
181 CMyVisitor(std::stringstream&
s) : m_s(
s) {}
182 virtual void OnVisitNode(
185 TYPE_EDGES>::Visitor::tree_t::TEdgeInfo& edge_to_child,
186 const size_t depth_level)
override
189 << (edge_to_child.reverse ?
"<-" :
"->")
190 << edge_to_child.id << std::endl;
193 CMyVisitor myVisitor(
s);
194 s <<
root << std::endl;