当前位置: 首页>>代码示例>>C++>>正文


C++ GiSTpath::Level方法代码示例

本文整理汇总了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;
    }
}
开发者ID:jsc0218,项目名称:MxTree,代码行数:31,代码来源:MTnode.cpp

示例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;
}
开发者ID:jsc0218,项目名称:MxTree,代码行数:41,代码来源:MTnode.cpp


注:本文中的GiSTpath::Level方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。