📄 rt.h
字号:
// -*- Mode: C++ -*-//--------------------------------------------------------------------// RT.h// ----// Implements the tree//// Class hierarchy:// GiSTobject// GiST// RT//// TPR-tree - Index for continuously moving objects// July 2001 release, Aalborg University//#ifndef RT_H#define RT_H#include "GiST.h"#include "GiSTfcnt.h"#include "rtnode.h"#include "rtpredicate.h"#include "rtbulksort.h"const double TPR_UI_FACTOR = 1.0; // For the mechanism of auto maintenance of time horizon #ifdef RT_DEL_LOOKUP#define RT_DEF_LOOKUP_SZ 200000#endif//------------------------------------------------// RT//class RT : public GiST{ friend class RTnode; public: RT (); ~RT(); // !!! Added for RNN testbed to be able to access the tree !!! // GiSTnode* GetNode (const GiSTpath& path) const { return ReadNode(path); } // void Create(const char *filename); void Open (const char *filename); void Close (); void Drop (); void Insert(const GiSTentry& entry); int Delete(const GiSTpredicate& pred); GiSTobjid IsA() const { return RT_CLASS; } void SetAutoHorizon (bool flag){ autoHorizon = flag; } bool GetAutoHorizon () const { return autoHorizon; } void SetWFactor(double x) { wfactor = x; } double GetWFactor() const { return wfactor; } void SetHorizon (RTperiod p, RTperiod qw = 0) { param = p; w = qw; } RTperiod GetParam () const { return param; } RTperiod GetW () const { return w; } void SetAlpha (double x) { alpha = x; } double GetAlpha () const { return alpha; } void SetRefTS (RTtimeStamp x) { reft = x; } RTtimeStamp GetRefTS () const { return reft; } RTtimeStamp GetLastCh() const { return lastChange; } void ResetCounter () { ((GiSTfileCnt*)Store())->ResetCounter(); } int GetCounter () { return ((GiSTfileCnt*)Store())->GetCounter(); } int PageSize () { return ((GiSTfileCnt *)Store())->PageSize(); } void SetBufferSize (int size) { ((GiSTfileCnt *)Store())->SetBufferSize(size); } int GetBufferSize () { return ((GiSTfileCnt *)Store())->GetBufferSize(); } void DeleteAll () { Store()->Reset(); } // Bulk load // Both methods assume that data contains moving points with GiSTpage's // void LoadTopDownSTR (RTsortArray& data); void LoadBottomUp (RTsortArray& data); // STR or Hilbert // Bulk unload // Unloads all data of the tree into sortArray, does not change the tree // RTsortArray* Unload() const; #ifdef RT_DEL_LOOKUP GiSTpage* delLookUp0; GiSTpage* delLookUp; int numDelLookUp0; int numDelLookUp; int levels; void ResetDelLookUp(); void InitDelLookUp (int numEntries);#endif // Functions for retrieving information relating to a tree-type // FixedKeyLength returns zero if entries are of variable length // virtual int FixedKeyLength (bool isLeaf) const; virtual int MinKeyLength (bool isLeaf) const; virtual int MaxKeyLength (bool isLeaf) const; virtual int MinEntries (bool isLeaf) const; // in a full node virtual int MaxEntries (bool isLeaf) const; // in a full node int HeaderSize () const { return 3*sizeof(short); }protected: int leafLength; int nonleafLength; void UpdateKeyLength(); // Updates leafLength and nonleafLength GiSTnode* CreateNode () const { return new RTnode; } GiSTstore* CreateStore() const { return new GiSTfileCnt; } int ForcedReinsert() const { return 1; } GiSTlist<GiSTentry*> RemoveTop (GiSTnode *node); void OldRemoveTop(GiSTnode *node, RTindexArray& out, RTindexArray& remains, int num_rem); // LoadNodes loads the coresponding tree level, // returning the sortArray of the next level // RTsortArray* LoadNodes(RTsortArray& data, int level); private: char file_nm[50]; // The name of the file storing the index bool autoHorizon; // Flag whether the horizon is auto-adaptable double wfactor; // A factor describing how horizon (param) is related to // average update interval RTperiod param; // Horizon length RTperiod w; // Querying window length double alpha; // a parameter (derived from param) for bulkloading // To automatically maintain the parameter a number of things have to be tracked // int numEntries; // aproximation of the # of live entries in the index RTtimeStamp lastReset; int numOp; // number of insertions performed since lastReset int horUpdateInt; // when numOp reaches horUpdateInt horizon is updated RTtimeStamp reft; // Reference time-stamp RTtimeStamp lastChange; // When the tree was changed last};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -