diff options
Diffstat (limited to 'src/Tree.cc')
-rw-r--r-- | src/Tree.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Tree.cc b/src/Tree.cc index 1561b4f..a451f24 100644 --- a/src/Tree.cc +++ b/src/Tree.cc @@ -3,6 +3,10 @@ #include <assert.h> +/*! + Returns the cached string representation of the subtree rootet by \a node. + If node is not cached, the cache will be rebuilt. +*/ const std::string &Tree::getString(const AbstractNode &node) const { assert(this->root_node); @@ -15,3 +19,12 @@ const std::string &Tree::getString(const AbstractNode &node) const } return this->nodecache[node]; } + +/*! + Sets a new root. Will clear the existing cache. + */ +void Tree::setRoot(const AbstractNode *root) +{ + this->root_node = root; + this->nodecache.clear(); +} |