📄 gistcursor.cpp
字号:
//--------------------------------------------------------------------// GiSTcursor.cpp// --------------//// GiST - Generalized Search Tree // June 2001 release, Aalborg University// // This file is a revised version of a part of the original // libGiST release (version 0.9beta1) // Copyright (c) 1996, Regents of the University of California//#include "GiST.h"//------------------------------------------------// GiSTcursor//GiSTcursor::GiSTcursor(const GiST& gist, const GiSTpredicate& query) : gist(gist){ this->query = (GiSTpredicate*) query.Copy(); first = 1; lastlevel = -1;}//------------------------------------------------GiSTentry*GiSTcursor::Next(){ GiSTpage page; while (first || !stack.IsEmpty()) { if (first) { page = GiSTRootPage; first = 0; } else { assert(lastlevel >= 0); GiSTentry *entry = stack.RemoveFront(); if (entry->IsLeaf()) return entry; // Pop off the stack for (int i=0; i < entry->Level() - lastlevel; i++) path.MakeParent(); page = entry->Ptr(); delete entry; } // Entry was a pointer to another node path.MakeChild(page); GiSTnode *node = gist.ReadNode(path); lastlevel = node->Level(); GiSTlist<GiSTentry*> list = node->Search(*query); while (!list.IsEmpty()) { GiSTentry *entry = list.RemoveRear(); stack.Prepend(entry); } delete node; } // The search is over... return NULL;}//------------------------------------------------GiSTcursor::~GiSTcursor(){ Flush(); if (query != NULL) delete query;}//------------------------------------------------const GiSTpath&GiSTcursor::Path() const{ return path;}//------------------------------------------------// Ends searchvoidGiSTcursor::Flush() { first = 0; while (!stack.IsEmpty()) delete stack.RemoveFront(); }//------------------------------------------------// GiSTdebugCursor//GiSTentry* GiSTdebugCursor::Next(){ GiSTentry* entry = NULL; do { if (entry) delete entry; entry = GiSTcursor::Next(); if (!entry) return NULL; } while (!realQuery->Consistent(*entry)); return entry;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -