⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtnode.h

📁 此文件包含了在linux下实现tpr-tree索引的源代码
💻 H
字号:
// -*- Mode: C++ -*-//--------------------------------------------------------------------//      RTnode.h//      --------//      Implements the node of the tree////      Classes declared://      RTindexArray, RTnode////      Class hierarchy://      RTindexArray//      GiSTobject//        GiSTnode//          RTnode////      TPR-tree - Index for continuously moving objects//      July 2001 release, Aalborg University//#ifndef RTNODE_H#define RTNODE_H#include "GiSTnode.h"#include "rtentry.h"#include <iostream.h>//--------------------------------------------------------------------//    RTindexArray////    Array of entry indices for algorithms where only a subset of a//    node's entries are considered//    class RTindexArray{public:   RTindexArray(int l = 1) : len(l), num(0) { array = new int[l]; }   RTindexArray(const RTindexArray& from);   ~RTindexArray() { delete[] array; }     RTindexArray& operator=   (const RTindexArray& from);        RTindexArray& DefaultInit ();   int           GetNum () const          { return  num; }   int           IsEmpty() const          { return !num; }   RTindexArray& Reset()                  { num = 0; return *this; }   int&          operator[] (int n) const;   int*          GetArrayPointer () const { return array; }   RTindexArray& Add   (int i);   RTindexArray& Remove(int n);protected:   int   len;   int   num;   int*  array;};//--------------------------------------------------------------------//    RTnode////    It is assumed that, at all times, all entries of the node //    have the same reference timestamps as the node. //class RTnode: public GiSTnode{public:   RTnode() : GiSTnode(), refts(0) {}   RTnode(const RTnode& node) : GiSTnode(node), refts(node.refts) {}   GiSTobjid   IsA()         const { return RTNODE_CLASS; }   GiSTentry*  CreateEntry() const { return new RTentry;  }   int         FixedLength() const;   GiSTobject* Copy       () const { return new RTnode(*this); }   void        SetRefTS   (RTtimeStamp rts);   RTtimeStamp RefTS      () const          { return refts; }         void        DoSplit    (RTindexArray& group1, RTindexArray& group2);// void        InsertBefore(const GiSTentry &entry, int index);   GiSTpage    SearchMinPenalty(const GiSTentry& entry) const;   GiSTnode*   PickSplit    ();   GiSTentry*  Union        () const;   // Helper function UnionEntries    // actual = false means that the returned entry is just for decision making     // actual = true means that the returned entry will be installed in the tree    //   RTentry*    UnionEntries (const RTindexArray& ix,                             int min, int max, bool actual = false) const;   bool        CheckUnion (const RTindexArray& ix,                           int min, int max, const RTentry& br) const;protected:   void        Pack  (char *page);   void        HeaderFromString(const char* buf);   void        HeaderToString  (char* buf) const;   int         HeaderSize      () const;   void        RstarSplit (RTindexArray& group1, RTindexArray& group2);   RTtimeStamp        refts;    // Node-wide reference timestamp };#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -