| 1 | // =============================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : gb_index.h // |
|---|
| 4 | // Purpose : // |
|---|
| 5 | // // |
|---|
| 6 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 7 | // http://www.arb-home.de/ // |
|---|
| 8 | // // |
|---|
| 9 | // =============================================================== // |
|---|
| 10 | |
|---|
| 11 | #ifndef GB_INDEX_H |
|---|
| 12 | #define GB_INDEX_H |
|---|
| 13 | |
|---|
| 14 | #ifndef GB_MEMORY_H |
|---|
| 15 | #include "gb_memory.h" |
|---|
| 16 | #endif |
|---|
| 17 | #ifndef GB_DATA_H |
|---|
| 18 | #include "gb_data.h" |
|---|
| 19 | #endif |
|---|
| 20 | |
|---|
| 21 | // ---------------------- |
|---|
| 22 | // gb_if_entries |
|---|
| 23 | |
|---|
| 24 | struct gb_if_entries { |
|---|
| 25 | GB_REL_IFES rel_ie_next; |
|---|
| 26 | GB_REL_GBDATA rel_ie_gbd; |
|---|
| 27 | }; |
|---|
| 28 | |
|---|
| 29 | inline gb_if_entries *GB_IF_ENTRIES_NEXT(gb_if_entries *ie) { |
|---|
| 30 | return GB_RESOLVE(gb_if_entries *, ie, rel_ie_next); |
|---|
| 31 | } |
|---|
| 32 | inline void SET_GB_IF_ENTRIES_NEXT(gb_if_entries *ie, gb_if_entries *next) { |
|---|
| 33 | GB_SETREL(ie, rel_ie_next, next); |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | inline GBDATA *GB_IF_ENTRIES_GBD(gb_if_entries *ie) { |
|---|
| 37 | return GB_RESOLVE(GBDATA*, ie, rel_ie_gbd); |
|---|
| 38 | } |
|---|
| 39 | inline void SET_GB_IF_ENTRIES_GBD(gb_if_entries *ie, GBDATA *gbd) { |
|---|
| 40 | GB_SETREL(ie, rel_ie_gbd, gbd); |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | // ------------------------------ |
|---|
| 45 | // gb_index_files |
|---|
| 46 | |
|---|
| 47 | struct gb_index_files { |
|---|
| 48 | GB_REL_IFS rel_if_next; |
|---|
| 49 | GBQUARK key; |
|---|
| 50 | long hash_table_size; |
|---|
| 51 | long nr_of_elements; |
|---|
| 52 | GB_CASE case_sens; |
|---|
| 53 | GB_REL_PIFES rel_entries; |
|---|
| 54 | }; |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | #if (MEMORY_TEST==1) |
|---|
| 58 | |
|---|
| 59 | #define GB_ENTRIES_ENTRY(entries, idx) (entries)[idx] |
|---|
| 60 | #define SET_GB_ENTRIES_ENTRY(entries, idx, ie) (entries)[idx] = (ie); |
|---|
| 61 | |
|---|
| 62 | #else |
|---|
| 63 | |
|---|
| 64 | #define GB_ENTRIES_ENTRY(entries, idx) \ |
|---|
| 65 | ((gb_if_entries *) ((entries)[idx] ? ((char*)(entries))+((entries)[idx]) : NULp)) |
|---|
| 66 | |
|---|
| 67 | #define SET_GB_ENTRIES_ENTRY(entries, idx, ie) \ |
|---|
| 68 | do { \ |
|---|
| 69 | if (ie) { \ |
|---|
| 70 | (entries)[idx] = (char*)(ie)-(char*)(entries); \ |
|---|
| 71 | } \ |
|---|
| 72 | else { \ |
|---|
| 73 | (entries)[idx] = 0; \ |
|---|
| 74 | } \ |
|---|
| 75 | } while (0) |
|---|
| 76 | |
|---|
| 77 | #endif // MEMORY_TEST |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | inline GB_REL_IFES *GB_INDEX_FILES_ENTRIES(gb_index_files *ifs) { |
|---|
| 81 | return GB_RESOLVE(GB_REL_IFES *, ifs, rel_entries); |
|---|
| 82 | } |
|---|
| 83 | inline void SET_GB_INDEX_FILES_ENTRIES(gb_index_files *ixf, gb_if_entries **entries) { |
|---|
| 84 | GB_SETREL(ixf, rel_entries, entries); |
|---|
| 85 | } |
|---|
| 86 | |
|---|
| 87 | inline gb_index_files *GB_INDEX_FILES_NEXT(gb_index_files *ixf) { |
|---|
| 88 | return GB_RESOLVE(gb_index_files *, ixf, rel_if_next); |
|---|
| 89 | } |
|---|
| 90 | inline void SET_GB_INDEX_FILES_NEXT(gb_index_files *ixf, gb_index_files *next) { |
|---|
| 91 | GB_SETREL(ixf, rel_if_next, next); |
|---|
| 92 | } |
|---|
| 93 | |
|---|
| 94 | inline gb_index_files *GBCONTAINER_IFS(GBCONTAINER *gbc) { |
|---|
| 95 | return GB_RESOLVE(gb_index_files *, gbc, rel_ifs); |
|---|
| 96 | } |
|---|
| 97 | inline void SET_GBCONTAINER_IFS(GBCONTAINER *gbc, gb_index_files *ifs) { |
|---|
| 98 | GB_SETREL(gbc, rel_ifs, ifs); |
|---|
| 99 | } |
|---|
| 100 | |
|---|
| 101 | #else |
|---|
| 102 | #error gb_index.h included twice |
|---|
| 103 | #endif // GB_INDEX_H |
|---|