* or functionality.
*/
-#ifndef __BCGZ_H
+#ifndef __BGZF_H
#define __BGZF_H
#include <stdint.h>
#include <stdio.h>
-#include "zlib.h"
#include <stdbool.h>
-//#include "zutil.h"
+#include <zlib.h>
+#ifdef _USE_KNETFILE
+#include "knetfile.h"
+#endif
//typedef int8_t bool;
typedef struct {
int file_descriptor;
char open_mode; // 'r' or 'w'
- bool owned_file;
+ bool owned_file, is_uncompressed;
+#ifdef _USE_KNETFILE
+ union {
+ knetFile *fpr;
+ FILE *fpw;
+ } x;
+#else
FILE* file;
+#endif
int uncompressed_block_size;
int compressed_block_size;
void* uncompressed_block;
int64_t block_address;
int block_length;
int block_offset;
+ int cache_size;
const char* error;
+ void *cache; // a pointer to a hash table
} BGZF;
#ifdef __cplusplus
*/
int64_t bgzf_seek(BGZF* fp, int64_t pos, int where);
+/*
+ * Set the cache size. Zero to disable. By default, caching is
+ * disabled. The recommended cache size for frequent random access is
+ * about 8M bytes.
+ */
+void bgzf_set_cache_size(BGZF *fp, int cache_size);
+
#ifdef __cplusplus
}
#endif