2013-05-11 16:13:46 -04:00
|
|
|
#ifndef NODETREE_H
|
|
|
|
|
#define NODETREE_H
|
|
|
|
|
|
|
|
|
|
#ifndef NULL
|
|
|
|
|
#define NULL 0
|
2013-05-20 19:34:15 -04:00
|
|
|
#endif
|
2013-05-11 16:13:46 -04:00
|
|
|
|
2013-06-23 05:54:58 -04:00
|
|
|
#include <util.h>
|
2013-06-27 23:45:38 -04:00
|
|
|
#include <Symbol.h>
|
2013-06-23 05:54:58 -04:00
|
|
|
|
2013-05-11 16:13:46 -04:00
|
|
|
#include <vector>
|
|
|
|
|
#include <string>
|
2013-06-23 05:54:58 -04:00
|
|
|
#include <iostream>
|
2013-05-11 16:13:46 -04:00
|
|
|
|
2013-06-27 23:45:38 -04:00
|
|
|
//Circular references
|
|
|
|
|
class Symbol;
|
|
|
|
|
|
2013-05-11 16:13:46 -04:00
|
|
|
class NodeTree {
|
|
|
|
|
public:
|
|
|
|
|
NodeTree();
|
2013-06-27 23:45:38 -04:00
|
|
|
NodeTree(std::string name, Symbol* inSymbol);
|
2013-05-11 16:13:46 -04:00
|
|
|
~NodeTree();
|
|
|
|
|
|
|
|
|
|
void setParent(NodeTree* parent);
|
|
|
|
|
NodeTree* getParent();
|
|
|
|
|
|
|
|
|
|
void addChild(NodeTree* child);
|
|
|
|
|
int findChild(NodeTree* child);
|
|
|
|
|
void removeChild(NodeTree* child);
|
|
|
|
|
void removeChild(int index);
|
|
|
|
|
|
|
|
|
|
NodeTree* get(int index);
|
|
|
|
|
|
2013-06-27 23:45:38 -04:00
|
|
|
std::string getName();
|
2013-05-11 16:13:46 -04:00
|
|
|
void setName(std::string);
|
|
|
|
|
|
2013-06-27 23:45:38 -04:00
|
|
|
Symbol* getSymbol();
|
|
|
|
|
void setSymbol(Symbol* symbol);
|
|
|
|
|
|
2013-05-11 16:13:46 -04:00
|
|
|
int size();
|
|
|
|
|
std::string DOTGraphString();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::string DOTGraphStringHelper();
|
2013-06-23 05:54:58 -04:00
|
|
|
std::string getDOTName();
|
2013-05-11 16:13:46 -04:00
|
|
|
std::string name;
|
2013-06-27 23:45:38 -04:00
|
|
|
Symbol* symbol;
|
2013-05-11 16:13:46 -04:00
|
|
|
NodeTree* parent;
|
|
|
|
|
std::vector<NodeTree*> children;
|
2013-06-23 05:54:58 -04:00
|
|
|
|
|
|
|
|
static int idCounter;
|
|
|
|
|
int id;
|
2013-05-11 16:13:46 -04:00
|
|
|
};
|
|
|
|
|
|
2013-05-20 19:34:15 -04:00
|
|
|
#endif
|