Last change
on this file was
14006,
checked in by westram, 9 years ago
|
- partial merge from 'alilink' into 'trunk'
- adds GB_remove_hierarchy_callback
- adds new flavor of GB_add_hierarchy_callback (allows to install path before it exists)
- several refactoring in callback code
- adds:
|
File size:
2.1 KB
|
Line | |
---|
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; |
---|
32 | long next_free_key; |
---|
33 | long nref_last_saved; |
---|
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 | |
---|
48 | inline GBQUARK GB_KEY_QUARK(GBDATA *gbd) { return GB_DATA_LIST_HEADER(GB_FATHER(gbd)->d)[gbd->index].flags.key_quark; } |
---|
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 |
---|
Note: See
TracBrowser
for help on using the repository browser.