00001
00002
00004
00005
00006
00008
00009 #ifndef __DasherNode_h__
00010 #define __DasherNode_h__
00011
00012 #include "NoClones.h"
00013 #include "DasherTypes.h"
00014 #include "LanguageModel.h"
00015
00016 namespace Dasher {class CDasherNode;}
00017 class Dasher::CDasherNode : private NoClones
00018 {
00019
00020
00021 private:
00022 const unsigned int m_iLbnd,m_iHbnd;
00023 const unsigned int m_iGroup;
00024 unsigned int m_iChars, m_iAge;
00025 bool m_bAlive;
00026 bool m_bControlNode;
00027 bool m_bControlChild;
00028
00029 Opts::ColorSchemes m_ColorScheme;
00030 int m_iPhase;
00031 int m_iColour;
00032
00033 const symbol m_Symbol;
00034 CLanguageModel *m_languagemodel;
00035 CDasherNode **m_Children;
00036 CDasherNode *m_parent;
00037 CLanguageModel::CNodeContext *m_context;
00038 public:
00039
00040 CDasherNode(CDasherNode *parent,symbol Symbol, unsigned int igroup, int iphase, Opts::ColorSchemes ColorScheme,int ilbnd,int ihbnd,CLanguageModel *lm, int Colour);
00041 ~CDasherNode();
00042 bool m_bForce;
00043
00044
00045 CDasherNode ** const Children() const {return m_Children;}
00046 unsigned int Lbnd() const {return m_iLbnd;}
00047 bool Alive() {return m_bAlive;}
00048 bool Control() {return m_bControlChild;}
00049 void Kill() {m_bAlive=0;m_iAge=0;}
00050 unsigned int Hbnd() const {return m_iHbnd;}
00051 unsigned int Group() const {return m_iGroup;}
00052 unsigned int Age() const {return m_iAge;}
00053 symbol Symbol() const {return m_Symbol;}
00054 unsigned int Chars() const {return m_iChars;}
00055 int Phase() const {return m_iPhase;}
00056 Opts::ColorSchemes Cscheme() const {return m_ColorScheme;}
00057 int Colour() const {return m_iColour;}
00058
00059 CDasherNode* const Get_node_under(int,myint y1,myint y2,myint smousex,myint smousey);
00060 void Get_string_under(const int,const myint y1,const myint y2,const myint smousex,const myint smousey,std::vector<symbol>&) const;
00061 void Generic_Push_Node(CLanguageModel::CNodeContext *context);
00062 void Push_Node();
00063 void Push_Node(CLanguageModel::CNodeContext *context);
00064 void Delete_children();
00065 void Dump_node() const;
00066 };
00067
00069
00071
00072 using namespace Dasher;
00073 using namespace Opts;
00074
00076
00077 inline CDasherNode::CDasherNode(CDasherNode *parent,symbol Symbol, unsigned int igroup, int iphase, ColorSchemes ColorScheme,int ilbnd,int ihbnd,CLanguageModel *lm, int Colour=0) :
00078 m_iLbnd(ilbnd),
00079 m_iHbnd(ihbnd),
00080 m_iGroup(igroup),
00081 m_iChars(0),
00082 m_iAge(0),
00083 m_bAlive(1),
00084 m_bControlChild(false),
00085 m_ColorScheme(ColorScheme),
00086 m_iPhase(iphase),
00087 m_iColour(Colour),
00088 m_Symbol(Symbol),
00089 m_languagemodel(lm),
00090 m_Children(0),
00091 m_parent(parent),
00092 m_context(0),
00093 m_bForce(false)
00094 {
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114 }
00115
00117
00118 inline void CDasherNode::Delete_children()
00119 {
00120 if (m_Children) {
00121 unsigned int i;
00122 for (i=1;i<m_iChars;i++)
00123 delete m_Children[i];
00124 delete [] m_Children;
00125 }
00126 m_Children=0;
00127
00128 }
00129
00131
00132 inline CDasherNode::~CDasherNode()
00133 {
00134 Delete_children();
00135 if (m_context)
00136 m_languagemodel->ReleaseNodeContext(m_context);
00137 }
00138
00140
00141 #endif