-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathio.h
63 lines (48 loc) · 1.85 KB
/
io.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
59
60
61
62
63
#ifndef IO_H_INCLUDED
#define IO_H_INCLUDED
#include "config.h"
// used to access BWTs in external memory
void open_bw_files(g_data *g);
void rewind_bw_files(g_data *g);
void close_bw_files(g_data *g);
void open_sa_files(g_data *g);
void rewind_sa_files(g_data *g);
void close_sa_files(g_data *g);
void open_sl_files(g_data *g);
void rewind_sl_files(g_data *g);
void close_sl_files(g_data *g);
void open_da_files(g_data *g);
void rewind_da_files(g_data *g);
void close_da_files(g_data *g);
void open_qs_files(g_data *g);
void rewind_qs_files(g_data *g);
void close_qs_files(g_data *g);
FILE *gap_tmpfile(char* path);
void huge_pwrite(int fd, const void *buf, size_t count, off_t offset);
void huge_pread(int fd, void *buf, size_t count, off_t offset);
void cwriter_put(cwriter *w, palette c);
void cwriter_skip(cwriter *w, uint64_t s);
void cwriter_close(cwriter *w);
off_t cwriter_tell(cwriter *w);
void cwriter_init(cwriter *w, int fd, size_t size, off_t o);
// by default a bitfile buffer is 8 file buffers
#define Bitfile_bufsize_bytes (8*BUFSIZ)
// structure supporting sequential read&write on a file representing a sequence of bits
typedef struct{
int fd; // file descriptor
off_t offset; // offset inside file descriptor (in bytes)
uint8_t *buffer;
size_t filesize; // max number of bits stored in file
int size; // actual buffer size (in bits)
int cur; // current position (in bits)
} bitfile;
void bitfile_flush(bitfile *b);
void bitfile_create(bitfile *b, size_t size, char *path, int);
void bitfile_destroy(bitfile *b);
void bitfile_rewind(bitfile *b);
bool bitfile_read_or_write(bitfile *b, bool new);
void bitfile_skip(bitfile *b, uint64_t s);
off_t bitfile_tell(bitfile *b);
// used for extract hi bit from mergefile for later dbGraph construction
void extract_bitfile(char *name, size_t size, char *outpath, int order);
#endif