本文整理汇总了C++中GiSTpath::Level方法的典型用法代码示例。如果您正苦于以下问题:C++ GiSTpath::Level方法的具体用法?C++ GiSTpath::Level怎么用?C++ GiSTpath::Level使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GiSTpath
的用法示例。
在下文中一共展示了GiSTpath::Level方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Path
void
MTnode::InvalidateEntry (BOOL bNew)
{
GiSTpath path = Path ();
if (path.Level() > 1) { // len>=3
MTnode *parentNode = ((MT *)Tree())->ParentNode((MTnode *)this);
for (int i=0; i<parentNode->NumEntries(); i++) { // search the entry in the parent's node
MTentry *entry = (MTentry *) (*parentNode)[i].Ptr();
if (entry->Ptr() == path.Page()) {
if (bNew) {
entry->Key()->distance = -MaxDist();
}
entry->Key()->splitted = TRUE;
break;
}
}
path.MakeParent ();
MTnode *grandNode = ((MT *)Tree())->ParentNode(parentNode);
for (int i=0; i<grandNode->NumEntries(); i++) { // search the entry in the grandparent's node
MTentry *entry = (MTentry *) (*grandNode)[i].Ptr();
if (entry->Ptr() == path.Page()) {
entry->SetMaxRadius(-1);
break;
}
}
((MT *)Tree())->WriteNode(parentNode); // write parent node (in inconsistent state)
((MT *)Tree())->WriteNode(grandNode); // write grandparent node (to invalidate the parent's entry)
delete parentNode;
delete grandNode;
}
}
示例2: ParentEntry
GiSTentry *
MTnode::Union () const
{
Object *objTemp = NULL;
if (!obj) { // retrieve the node's parent object
MTentry *parentEntry = ParentEntry ();
((MTnode *)this)->obj = (objTemp = new Object(parentEntry->object()));
delete parentEntry;
}
GiSTpath path = ((MTnode *)this)->Path();
MTentry *unionEntry = new MTentry;
unionEntry->InitKey();
if (path.Level() > 1) { // len>=3
MTentry *parentEntry = ParentEntry ();
if (parentEntry) { // copy the entry
unionEntry->Key()->distance = parentEntry->Key()->distance;
if (parentEntry->Key()->splitted) {
unionEntry->Key()->splitted = TRUE;
}
delete parentEntry;
}
if (unionEntry->Key()->distance == -MaxDist()) { // compute the distance from the parent
MTnode *parentNode = ((MT *)Tree())->ParentNode((MTnode *)this);
MTentry *grandEntry = parentNode->ParentEntry();
unionEntry->Key()->distance = obj->distance(grandEntry->object());
unionEntry->Key()->splitted = TRUE;
delete grandEntry;
delete parentNode;
}
}
unionEntry->SetObject(*obj);
unionEntry->SetMaxRadius(0);
unionEntry->SetMinRadius(MAXDOUBLE);
mMRadius (unionEntry); // compute the radii
if (objTemp) {
delete objTemp;
}
((MTnode *)this)->obj = NULL;
return unionEntry;
}