Update node.h
This commit is contained in:
parent
e1c649cb34
commit
1e00ad65a1
1 changed files with 7 additions and 3 deletions
|
@ -12,7 +12,8 @@ class Node
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Node(const std::string &name = "");
|
Node(const std::string &name);
|
||||||
|
Node();
|
||||||
virtual ~Node();
|
virtual ~Node();
|
||||||
|
|
||||||
std::string get_name() const;
|
std::string get_name() const;
|
||||||
|
@ -22,7 +23,8 @@ class Node
|
||||||
Node *get_child(int i) const;
|
Node *get_child(int i) const;
|
||||||
void add_child(Node *child);
|
void add_child(Node *child);
|
||||||
|
|
||||||
void print(std::ostream &str = std::cout, uint32_t depth = 0) const;
|
void print(std::ostream& stream) const;
|
||||||
|
void print(std::ostream& stream, int level, std::set<const Node*>& set) const;
|
||||||
static Node *create_complete_tree(uint32_t nr_child_nodes, uint32_t tree_depth);
|
static Node *create_complete_tree(uint32_t nr_child_nodes, uint32_t tree_depth);
|
||||||
static void traverse_tree(const Node *node, std::function<void(const Node *, uint32_t)> predicate, bool recursive, uint32_t depth = 0);
|
static void traverse_tree(const Node *node, std::function<void(const Node *, uint32_t)> predicate, bool recursive, uint32_t depth = 0);
|
||||||
|
|
||||||
|
@ -36,6 +38,8 @@ class Node
|
||||||
static void traverse_tree_iterative(const Node *node, std::function<void(const Node *, uint32_t)> predicate, uint32_t depth = 0);
|
static void traverse_tree_iterative(const Node *node, std::function<void(const Node *, uint32_t)> predicate, uint32_t depth = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string repeat(std::string value, int times);
|
||||||
|
|
||||||
extern std::ostream &operator<<(std::ostream &os, const Node *node);
|
extern std::ostream &operator<<(std::ostream &os, const Node *node);
|
||||||
|
|
||||||
#endif // NODE_H
|
#endif // NODE_H
|
||||||
|
|
Loading…
Reference in a new issue