diff options
Diffstat (limited to 'src/Tree.cc')
-rw-r--r-- | src/Tree.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Tree.cc b/src/Tree.cc new file mode 100644 index 0000000..1561b4f --- /dev/null +++ b/src/Tree.cc @@ -0,0 +1,17 @@ +#include "Tree.h" +#include "nodedumper.h" + +#include <assert.h> + +const std::string &Tree::getString(const AbstractNode &node) const +{ + assert(this->root_node); + if (!this->nodecache.contains(node)) { + NodeDumper dumper(this->nodecache, false); + Traverser trav(dumper, *this->root_node, Traverser::PRE_AND_POSTFIX); + trav.execute(); + assert(this->nodecache.contains(*this->root_node) && + "NodeDumper failed to create a cache"); + } + return this->nodecache[node]; +} |