1 |
root |
1.1 |
#ifndef PMT_H |
2 |
|
|
#define PMT_H |
3 |
|
|
|
4 |
|
|
#include <GiSTlist.h> |
5 |
|
|
|
6 |
root |
1.3 |
typedef unsigned long velem; |
7 |
|
|
|
8 |
root |
1.1 |
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 |
root |
1.3 |
velem vzero; |
22 |
|
|
|
23 |
|
|
int distfast; // can distance be computed fast (integer arithmetic) |
24 |
|
|
double distmul; // then use this corrective factor |
25 |
root |
1.1 |
|
26 |
|
|
public: |
27 |
root |
1.3 |
PMT(int ndims, |
28 |
|
|
double min, |
29 |
|
|
double max, |
30 |
|
|
double steps, |
31 |
|
|
unsigned int pagesize); |
32 |
root |
1.1 |
~PMT(); |
33 |
root |
1.3 |
void sync(); |
34 |
root |
1.1 |
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 |
root |
1.2 |
int maxlevel() const; |
41 |
root |
1.1 |
//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 |
root |
1.2 |
extern void add_result(int data, double *k, int ndims); |
50 |
root |
1.1 |
|
51 |
|
|
#endif |