-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpartition.h
58 lines (51 loc) · 1.61 KB
/
partition.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef __PARTITION_H_
#define __PARTITION_H_
#include "spade.h"
#include <sys/time.h>
extern struct timeval tp;
#define seconds(tm) gettimeofday(&tp,(struct timezone *)0);\
tm=tp.tv_sec+tp.tv_usec/1000000.0
extern int num_partitions;
extern void partition_alloc(char *dataf, char *idxf);
extern void partition_dealloc();
extern void partition_get_blk(int *MAINBUF, int p);
extern int partition_get_blk_sz(int p);
extern int partition_get_max_blksz();
extern int partition_get_idxsup(int it);
extern int partition_get_lidxsup(int idx, int it);
extern int partition_get_idx(int idx, int it);
extern int *partition_idx(int idx);
extern void partition_read_item(int *ival, int it);
extern void partition_lclread_item(int *ival, int pnum, int it);
extern void partition_get_minmaxcustid(int *backidx, int numit, int pnum,
int &minv, int &maxv);
#define NOCLASS -1
class ClassInfo{
private:
static int fd;
static int *clsaddr;
static int *classes;
public:
static int *CLASSCNT;
static int *MINSUP;
static ullint *TMPE; // temporary variables to keep support
static ullint *TMPM; // counts during intersections
static ullint *TMPL;
ClassInfo(char use_class, char *classf);
~ClassInfo();
static int getcnt(int cls=-1){
if (cls == -1){
int sum = 0;
for (int i=0; i < NUMCLASS; i++)
sum += CLASSCNT[i];
return sum;
}
else return CLASSCNT[cls];
}
static int getcls(int idx){
if (fd == -1)
return 0;
else return classes[idx];
}
};
#endif// __PARTITION_H_