#include <PathTree.hpp>
Public Methods | |
| void | CreateRootNode () |
| PathTreeNode * | GetRootNode () |
| PathTreeNode * | ExtendCurPath (PathTreeNode *curnode, TLabelID labelid) |
| void | ReleaseMemory () |
|
|
Definition at line 195 of file PathTree.cpp. 00197 {
00198 unsigned char isaccepting;
00199
00200 rootnode.parent=NULL;
00201 rootnode.labelid=LABEL_UNDEFINED;
00202 #ifdef PROFILE
00203 nodecount=0;
00204 lookupcount=0;
00205 hashitercount=0;
00206 fsmstatecount=0;
00207 #endif
00208
00209 // rootnode.fsmstatelist=pathexprman.CreateInitStateList(&isaccepting);
00210 rootnode.ComputeInitStateList(&isaccepting);
00211
00212 rootnode.isaccepting=isaccepting;
00213 }
|
|
||||||||||||
|
Definition at line 218 of file PathTree.cpp. 00224 {
00225 unsigned char isaccepting;
00226 PathTreeNode *node;
00227
00228 #ifndef USE_NO_DATAGUIDE
00229 unsigned long hashidx=ComputePathTreeHashIdx(curnode,labelid);
00230
00231 #ifdef PROFILE
00232 lookupcount++;
00233 #endif
00234
00235 // First, we check whether we already have an edge with the
00236 // same label.
00237 node=pathtreehashtable[hashidx];
00238
00239 while(node!=NULL)
00240 {
00241 #ifdef PROFILE
00242 hashitercount++;
00243 #endif
00244
00245 if((node->parent==curnode)&&
00246 (node->labelid==labelid))
00247 break;
00248 node=node->nextsamehash;
00249 }
00250
00251 if(node!=NULL)
00252 // if an edge with the label already exists ? ==> We return it
00253 return node;
00254
00255 #ifdef PROFILE
00256 nodecount++;
00257 #endif
00258
00259 #endif // USE_NO_DATAGUIDE
00260
00261 // If we don't have an edge with the label, we create a new dataguide node
00262 node=new PathTreeNode();
00263 node->parent=curnode;
00264 node->labelid=labelid;
00265
00266 // ... and compute the set of FSM states for that node
00267 node->ComputeNextStateList(labelid,&isaccepting);
00268
00269 node->isaccepting=isaccepting;
00270
00271 #ifndef USE_NO_DATAGUIDE
00272 node->nextsamehash=pathtreehashtable[hashidx];
00273 pathtreehashtable[hashidx]=node;
00274 #endif
00275
00276 return node;
00277 }
|
|
|
Definition at line 117 of file PathTree.hpp. 00117 { return &rootnode; }
|
|
|
Definition at line 279 of file PathTree.cpp. 00280 {
00281 // pathtreemem->ReleaseMemory();
00282 // pathtreemem.Initialize(5);
00283 // Init();
00284
00285 for(int i=0;i<PATHTREE_HASHSIZE;i++)
00286 pathtreehashtable[i]=NULL;
00287 }
|
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001