1 |
#ifndef PMT_H |
2 |
#define PMT_H |
3 |
|
4 |
#include <GiSTlist.h> |
5 |
|
6 |
typedef unsigned long velem; |
7 |
|
8 |
class MT; |
9 |
|
10 |
class PMT { |
11 |
MT *mt; |
12 |
|
13 |
public: // easier. I don't care anyways |
14 |
int ndims; |
15 |
double min; |
16 |
double max; |
17 |
double steps; |
18 |
|
19 |
double maxDist; |
20 |
int elemsize; |
21 |
velem vzero; |
22 |
|
23 |
int distfast; // can distance be computed fast (integer arithmetic) |
24 |
double distmul; // then use this corrective factor |
25 |
|
26 |
public: |
27 |
PMT(int ndims, |
28 |
double min, |
29 |
double max, |
30 |
double steps, |
31 |
unsigned int pagesize); |
32 |
~PMT(); |
33 |
void sync(); |
34 |
void create(const char *path); |
35 |
void open(const char *path); |
36 |
void insert(double *k, int data); |
37 |
double distance(double *k1, double *k2) const; |
38 |
void range(double *k, double r) const; |
39 |
void top(double *k, int n) const; |
40 |
int maxlevel() const; |
41 |
//bulkload(PKey *o, int count); |
42 |
}; |
43 |
|
44 |
#define ACC (current_pmt) |
45 |
#define NDIMS (ACC->ndims) |
46 |
|
47 |
extern const PMT *current_pmt; |
48 |
|
49 |
extern void add_result(int data, double *k, int ndims); |
50 |
|
51 |
#endif |