openscad/src/Tree.h

28 lines
668 B
C
Raw Normal View History

#pragma once
#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.
*/
class Tree
{
public:
Tree(const AbstractNode *root = NULL) : root_node(root) {}
~Tree();
2010-11-06 18:04:03 +03:00
void setRoot(const AbstractNode *root);
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;
private:
const AbstractNode *root_node;
mutable NodeCache nodecache;
2011-09-11 12:51:55 +04:00
mutable NodeCache nodeidcache;
};