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

📄 pool.h

📁 此文件包含了在linux下实现tpr-tree索引的源代码
💻 H
字号:
//--------------------------------------------------------------------//   pool.h//   ------    //   Pool of moving points//   Defined: TMovingPoint, TPool ////   Moving point workload generator v 1.1//   Copyright(c) 1999-2001, Aalborg University//#ifndef __POOL_H#define __POOL_H#include <iostream.h>#include <stddef.h>#include "random.h"#define POOL_INC     1000#define GEN_MAXDIMS  3//------------------------------------------------//     TMovingPoint//struct TMovingPoint{   static int Dims;        // Number of dimensions        long  id;   float xref[GEN_MAXDIMS];            float v[GEN_MAXDIMS];         float start;            // Time when started to move from hubfrom   float utime;            // Next update time    float imprec;           // Acccumulated imprecision (frequency of updates)   int   updates;          // # of updates per leg    int   phase;            // # of updates so far in the leg, -1 - uninitialized   char  type;             // Type of object (cruising speed and altitude)   char  inindex;          // Flag - whether a point is in the index     unsigned short hubfrom;   unsigned short hubto;   // Origin and destination #ifdef RT_EXPIRATION   float exptime;          // Expiration time#endif      ostream& write(ostream& os);     friend ostream& operator << (ostream& os, TMovingPoint& mvp);};//------------------------------------------------//     THub//struct THub{   float  x;   float  y;      bool operator==(const THub& hub) {return x == hub.x && y == hub.y;}};//------------------------------------------------// TPool - is a heap of TMovingPoint's// TPool "owns" TMovingPoints, i.e., it deletes them in ~TPool//class TPool{public:   TPool()      : array(NULL), mem (NULL), len(0), num(0) {}   TPool(int n) : array(NULL), mem (NULL)     { setLen(n); }   ~TPool();   void setLen (int n);   int  getNum () const { return num; }   TMovingPoint* operator[] (int n) const;   TMovingPoint* Top() const;     // Returns the top of a heap             TMovingPoint* AddNew  ();      // Returns the address to a new point    void          Sort();          // Arrange elements in a heap   void          Schedule();      // Positions the modified top element in the heap// void          Delete  (int n);protected:   int            len;   int            num;   TMovingPoint** array;   // a heap as an array   TMovingPoint*  mem;     // memory for TMovingPoints  };#endif

⌨️ 快捷键说明

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