📄 rtobserver.h
字号:
// -*- Mode: C++ -*-//--------------------------------------------------------------------// RTobserver.h// ------------// Implements the observer of the tree//// Class hierarchy:// GiSTobject// GiSTobserver// RTobserver//// TPR-tree - Index for continuously moving objects// July 2001 release, Aalborg University//#ifndef RTOBSERVER_H#define RTOBSERVER_H#include "GiSTobserver.h"#include "rt.h"#include "rtvisualizer.h"#include <fstream.h>enum RTNotification{ ON_SOFT_SPLIT};enum RTvisobject {voTree, voPath, voNode, voLevel, voNone};struct RTtreeStats{ RTkey avgMBRsizes[GIST_MAX_LEVELS]; double deadspace; double overlap; double volumeAll; double volumeLeaf; double marginAll; double utilInternal; // space utilization (pagination) double utilLeaf; int entriesInternal; int entriesLeaf; int levels;};#define RTOBS_INSERTINF "insert.inf"#define RTOBS_NODESINF "nodes.inf"#define RTOBS_SEARCHINF "search.inf"#define RTOBS_SPLITINF "split.inf"//------------------------------------------------// RTobserver//class RTobserver : public GiSTobserver{public: RTobserver() : GiSTobserver(), insertinf(RTOBS_INSERTINF, ios::app), nodeinf(RTOBS_NODESINF, ios::out), queryinf(RTOBS_SEARCHINF, ios::out), splitinf(RTOBS_SPLITINF, ios::out) { SplitInfoOn = 0; InsertInfoOn = 0; SearchInfoOn = 0; FlowInfoOn = 0; visObject = voNone; Reset(); } ~RTobserver(); void Reset() { ResetFlowInfo(); ResetSearchInfo(); } void ResetFlowInfo(); void ResetSearchInfo(); void Refresh(); void Visualize (RTvisobject what, int level = 0, RTperiod interval = 0.0); // Properties computes properties of the tree, and compares them to // the properties of the bulkloaded tree if opt is true // void Properties(ostream& os, bool opt = false); void Inform (RTNotification nc, int axis, int index); void Inform (TNotification nc); void Inform (TNotification nc, int qual, int total, int level); void Inform (TNotification nc, const GiSTentry& entry1, const GiSTentry& entry2, GiSTpage page); void Inform (TNotification nc, const GiSTnode& node); void Inform (TNotification nc, GiSTlist<GiSTentry*>& elist); void Inform (TNotification nc, const GiSTnode& node1, const GiSTnode& node2); void Inform (TNotification nc, const GiSTpredicate& pred); void SetSplitInfo(int status) { SplitInfoOn = status; } void SetInsertInfo(int status) { InsertInfoOn = status; } void SetSearchInfo(int status) { SearchInfoOn = status; } void SetFlowInfo(int status) { FlowInfoOn = status; } int GetSplitInfo() { return SplitInfoOn; } int GetInsertInfo() { return InsertInfoOn; } int GetSearchInfo() { return SearchInfoOn; } int GetFlowInfo() { return FlowInfoOn; } void OutFlowInfo(); void OutNodeInfo();private: RTtreeStats* TreeProperties (); double FilledArea (GiSTnode& node, RTentry& uentry); void OutSearchInfo (); void ChooseRandomPath (GiSTpath& path); // TraverseTree - visits all nodes of the tree and calls visitor on each node // void TraverseTree (GiSTpath& path, void (RTobserver::*visitor)(RTnode& node)); // Five visitors used in connection with TraverseTree // void ReadTree (RTnode& node); void CountNodes (RTnode& node); void OutTreeNodeInfo (RTnode& node); void VisualizeTreeNode (RTnode& node); void VisualizeLevelNode(RTnode& node); void VisualizePathNodes (); void DoVisualization (); ofstream insertinf; // Insertion information ofstream queryinf; // Query information ofstream splitinf; // Split information ofstream nodeinf; // Nodes information int qual_entries[GIST_MAX_LEVELS]; int total_entries[GIST_MAX_LEVELS]; int total_nodes[GIST_MAX_LEVELS]; int SplitInfoOn; int InsertInfoOn; int SearchInfoOn; int FlowInfoOn; long num_dealocate; long num_removetop; long num_split; long num_sortsplit; // Visualization // RTvisobject visObject; GiSTpath visPath; int visDepth; RTperiod visInterval; RTtimeStamp visLast; RTvisualizer visualizer;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -