ARB
gb_key.h
Go to the documentation of this file.
1 // =============================================================== //
2 // //
3 // File : gb_key.h //
4 // Purpose : //
5 // //
6 // Institute of Microbiology (Technical University Munich) //
7 // http://www.arb-home.de/ //
8 // //
9 // =============================================================== //
10 
11 #ifndef GB_KEY_H
12 #define GB_KEY_H
13 
14 #ifndef GB_HEADER_H
15 #include "gb_header.h"
16 #endif
17 #ifndef GB_MAIN_H
18 #include "gb_main.h"
19 #endif
20 #ifndef GB_TUNE_H
21 #include "gb_tune.h"
22 #endif
23 
24 
25 #define GB_KEY_LEN_MAX 64 // max. length of a key (a whole key path may be longer)
26 #define GB_KEY_LEN_MIN 2
27 
28 struct gb_Key {
29  char *key;
30 
31  long nref;
34 
35  GBDATA *gb_key; // for fast access and dynamic loading
36  GBCONTAINER *gb_master_ali; // master container
37  int gb_key_disabled; // There will never be a gb_key
38  int compression_mask; // maximum compression for this type
39  GB_DICTIONARY *dictionary; // optional dictionary
40 };
41 
42 inline GBQUARK key2quark(GB_MAIN_TYPE *Main, const char *key) {
43  return key ? GBS_read_hash(Main->key_2_index_hash, key) : -1;
44 }
45 inline const char *quark2key(GB_MAIN_TYPE *Main, GBQUARK key_quark) { return Main->keys[key_quark].key; }
46 inline long quark2gbmindex(GB_MAIN_TYPE *Main, GBQUARK key_quark) { return (Main->keys[key_quark].nref<GBM_MAX_UNINDEXED_ENTRIES) ? 0 : key_quark; }
47 
49 inline const char *GB_KEY(GBDATA *gbd) { return quark2key(GB_MAIN(gbd), GB_KEY_QUARK(gbd)); }
50 
51 
52 #else
53 #error gb_key.h included twice
54 #endif // GB_KEY_H
const char * quark2key(GB_MAIN_TYPE *Main, GBQUARK key_quark)
Definition: gb_key.h:45
GBDATA * gb_key
Definition: gb_key.h:35
GB_MAIN_TYPE * GB_MAIN(GBDATA *gbd)
Definition: gb_data.h:291
long nref
Definition: gb_key.h:31
GBCONTAINER * gb_master_ali
Definition: gb_key.h:36
CONSTEXPR_INLINE gb_header_list * GB_DATA_LIST_HEADER(gb_data_list &dl)
Definition: gb_data.h:105
Definition: gb_key.h:28
GB_DICTIONARY * dictionary
Definition: gb_key.h:39
GB_HASH * key_2_index_hash
Definition: gb_main.h:135
GBQUARK key2quark(GB_MAIN_TYPE *Main, const char *key)
Definition: gb_key.h:42
unsigned int key_quark
Definition: gb_header.h:21
const int GBM_MAX_UNINDEXED_ENTRIES
Definition: adtune.cxx:18
int gb_key_disabled
Definition: gb_key.h:37
long nref_last_saved
Definition: gb_key.h:33
int compression_mask
Definition: gb_key.h:38
CONSTEXPR_INLINE GBCONTAINER * GB_FATHER(GBDATA *gbd)
Definition: gb_data.h:271
char * key
Definition: gb_key.h:29
GBQUARK GB_KEY_QUARK(GBDATA *gbd)
Definition: gb_key.h:48
long index
Definition: gb_data.h:133
long quark2gbmindex(GB_MAIN_TYPE *Main, GBQUARK key_quark)
Definition: gb_key.h:46
gb_Key * keys
Definition: gb_main.h:134
gb_header_flags flags
Definition: gb_header.h:35
const char * GB_KEY(GBDATA *gbd)
Definition: gb_key.h:49
int GBQUARK
Definition: arbdb_base.h:30
long GBS_read_hash(const GB_HASH *hs, const char *key)
Definition: adhash.cxx:395
long next_free_key
Definition: gb_key.h:32