Update node.h

This commit is contained in:
Gregor 2019-05-08 11:11:06 +00:00
parent e1c649cb34
commit 1e00ad65a1

View file

@ -12,7 +12,8 @@ class Node
{
public:
Node(const std::string &name = "");
Node(const std::string &name);
Node();
virtual ~Node();
std::string get_name() const;
@ -22,7 +23,8 @@ class Node
Node *get_child(int i) const;
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 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);
};
std::string repeat(std::string value, int times);
extern std::ostream &operator<<(std::ostream &os, const Node *node);
#endif // NODE_H