]> git.donarmstrong.com Git - samtools.git/blobdiff - bgzf.h
* samtools-0.1.5-8 (r404)
[samtools.git] / bgzf.h
diff --git a/bgzf.h b/bgzf.h
index 7e76bcb9d7eeb128ba3b7047cb1211bdca582a91..d5eeafe7e527c57823b8b68cb2c32511f1b0fadd 100644 (file)
--- a/bgzf.h
+++ b/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;
@@ -32,7 +41,9 @@ typedef struct {
     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
@@ -95,6 +106,13 @@ int64_t bgzf_tell(BGZF* fp);
  */
 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