forked from RabbitBio/RabbitBAM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BamCompress.h
56 lines (38 loc) · 1016 Bytes
/
BamCompress.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
#ifndef BAMSTATUS_BAMCOMPRESS_H
#define BAMSTATUS_BAMCOMPRESS_H
#include "BamTools.h"
#include <thread>
#include <atomic>
class BamCompress {
public:
BamCompress();
void resize(int BufferSize, int threadNumber);
BamCompress(int BufferSize, int threadNumber);
bam_block *getEmpty();
void inputUnCompressData(bam_block *data, int block_num);
bam_block *getUnCompressData();
void backEmpty(bam_block *data);
void CompressThreadComplete() {
mtx_compressThread.lock();
compressThread--;
mtx_compressThread.unlock();
}
public:
int wait_num;
private:
std::atomic<int> blockNum;
bam_block **compress_data;
int compress_bg;
int compress_ed;
int compress_size;
std::mutex mtx_compress;
std::mutex mtx_input;
bam_block **consumer_data;
int consumer_bg;
int consumer_ed;
int consumer_size;
bool *is_ok;
int compressThread;
std::mutex mtx_compressThread;
};
#endif //BAMSTATUS_BAMCOMPRESS_H