1 /* $Id: indexdbdef.h 221726 2020-02-13 19:05:27Z twu $ */
2 #ifndef INDEXDBDEF_INCLUDED
3 #define INDEXDBDEF_INCLUDED
4 #ifdef HAVE_CONFIG_H
5 #include <config.h>		/* For HAVE_PTHREAD */
6 #endif
7 
8 #include "genomicpos.h"
9 #include "access.h"
10 #include "types.h"
11 
12 #ifdef PMAP
13 #include "alphabet.h"
14 #endif
15 
16 
17 #define BADVAL (Univcoord_T) -1
18 
19 /* Compression types */
20 #define NO_COMPRESSION 0
21 #define BITPACK64_COMPRESSION 1
22 
23 
24 #define T Indexdb_T
25 struct T {
26 #ifdef PMAP
27   Alphabet_T alphabet;
28   int alphabet_size;
29 #endif
30 
31   int compression_type;
32   Width_T index1part;
33   Width_T index1interval;
34   Blocksize_T blocksize;	/* e.g., 64 = 4^(15-12) */
35 
36 #if defined(LARGE_GENOMES) || defined(UTILITYP)
37   bool hugep;
38   Access_T offsetspages_access;
39   int offsetspages_shmid;
40   key_t offsetspages_key;
41   int offsetspages_fd;
42   size_t offsetspages_len;
43   UINT4 *offsetspages;
44 #endif
45 
46   Access_T offsetsmeta_access;
47   int offsetsmeta_shmid;
48   key_t offsetsmeta_key;
49   int offsetsmeta_fd;
50   size_t offsetsmeta_len;
51   UINT4 *offsetsmeta;
52 
53   Access_T offsetsstrm_access;
54   int offsetsstrm_shmid;
55   key_t offsetsstrm_key;
56   int offsetsstrm_fd;
57   size_t offsetsstrm_len;
58   UINT4 *offsetsstrm;
59 
60 #if defined(LARGE_GENOMES) || defined(UTILITYP)
61   Access_T positions_high_access;
62   int positions_high_shmid;
63   key_t positions_high_key;
64   int positions_high_fd;
65   size_t positions_high_len;
66 
67   unsigned char *positions_high;
68 #endif
69 
70   Access_T positions_access;
71   int positions_shmid;
72   key_t positions_key;
73   int positions_fd;
74   size_t positions_len;
75 
76   UINT4 *positions;		/* For small genomes, same as
77 				   Univcoord_T, but need to specify as
78 				   UINT4 to allow this to work with
79 				   large genomes */
80 
81   size_t total_npositions;	/* Needed to compute mean size */
82 
83 #ifdef HAVE_PTHREAD
84   pthread_mutex_t positions_read_mutex;
85 #endif
86 };
87 
88 #undef T
89 #endif
90 
91