-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.cpp
55 lines (43 loc) · 1.26 KB
/
main.cpp
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
#include "bitvector.h"
int main()
{
int fdes=_open("x.idx",O_RDONLY | O_BINARY);
// int fdes=_open("x_test3.cmx",O_RDONLY | O_BINARY);
int ofdes=_open("x_test3.cmx",O_WRONLY|O_BINARY|O_CREAT|O_TRUNC,_S_IREAD|_S_IWRITE);
// int ofdes0=_open("x_test2.cmx",O_WRONLY|O_BINARY|O_CREAT|O_TRUNC,_S_IREAD|_S_IWRITE);
uint32_t* offset=NULL;
char head[8];
//read header
_read(fdes,head,8);
uint32_t len[2];
//read length
_read(fdes,len,8);
offset=(uint32_t*)malloc(sizeof(uint32_t)*(len[1]+1));
//read offset
_read(fdes,offset,sizeof(uint32_t)*(len[1]+1));
_write(ofdes,head,8);
_write(ofdes,len,8);
_write(ofdes,offset,(len[1]+1)*4);
// _write(ofdes0,head,8);
// _write(ofdes0,len,8);
// _write(ofdes0,offset,(len[1]+1)*4);
//read bitmap
int i=0;
for(i=0;i<1;i++){
ibis::array_t<ibis::bitvector::word_t>
a0(fdes, offset[i], offset[i+1]);
ibis::bitvector* bv=new ibis::bitvector(a0); //we only read one bitvector as test
bv->sloppySize(len[0]);
// (*bv).decompress_compax();
//do some querry
//bv->WAH2COMPAX();
//bv->compress_icx();
//bv->decompress_icx(offset[i], offset[i+1]);
bv->write(ofdes); //need to be replaced by a for loop
//bv->decompress_compax();
//bv->write(ofdes0);
}
_close(fdes);
_close(ofdes);
return 0;
}