2014-04-28 21:09:25 +04:00
|
|
|
#pragma once
|
2010-04-12 04:16:36 +04:00
|
|
|
|
|
|
|
#include "nodecache.h"
|
|
|
|
|
2010-11-06 18:04:03 +03:00
|
|
|
/*!
|
|
|
|
For now, just an abstraction of the node tree which keeps a dump
|
|
|
|
cache based on node indices around.
|
|
|
|
|
|
|
|
Note that since node trees don't survive a recompilation, the tree cannot either.
|
|
|
|
*/
|
2010-04-12 04:16:36 +04:00
|
|
|
class Tree
|
|
|
|
{
|
|
|
|
public:
|
2010-09-07 04:02:22 +04:00
|
|
|
Tree(const AbstractNode *root = NULL) : root_node(root) {}
|
2011-12-06 04:16:54 +04:00
|
|
|
~Tree();
|
2010-04-12 04:16:36 +04:00
|
|
|
|
2010-11-06 18:04:03 +03:00
|
|
|
void setRoot(const AbstractNode *root);
|
2010-04-12 04:16:36 +04:00
|
|
|
const AbstractNode *root() const { return this->root_node; }
|
|
|
|
|
2011-10-26 18:59:26 +04:00
|
|
|
const std::string &getString(const AbstractNode &node) const;
|
|
|
|
const std::string &getIdString(const AbstractNode &node) const;
|
2010-04-12 04:16:36 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
const AbstractNode *root_node;
|
|
|
|
mutable NodeCache nodecache;
|
2011-09-11 12:51:55 +04:00
|
|
|
mutable NodeCache nodeidcache;
|
2010-04-12 04:16:36 +04:00
|
|
|
};
|