source: tags/svn.1.5.4/ARBDB/gb_header.h

Last change on this file was 6656, checked in by westram, 15 years ago
  • removed unneeded 'struct' keyword
  • renamed several structs (especially things like 'blabla_struct')
File size: 2.2 KB
Line 
1// =============================================================== //
2//                                                                 //
3//   File      : gb_header.h                                       //
4//   Purpose   :                                                   //
5//                                                                 //
6//   Institute of Microbiology (Technical University Munich)       //
7//   http://www.arb-home.de/                                       //
8//                                                                 //
9// =============================================================== //
10
11#ifndef GB_HEADER_H
12#define GB_HEADER_H
13
14#ifndef GB_DATA_H
15#include "gb_data.h"
16#endif
17
18
19struct gb_header_flags {
20    unsigned int flags : GB_MAX_USERS;              // public
21    unsigned int key_quark : 24;                    // == 0 -> invalid
22    unsigned int changed : 3;
23    unsigned int ever_changed : 1;                  // is this element ever changed
24};
25
26struct gb_header_list {                             // public fast flags
27    gb_header_flags flags;
28    GB_REL_GBDATA   rel_hl_gbd;
29    /* pointer to data
30       if 0 & !key_index -> free data
31       if 0 & key_index -> data only in server */
32};
33
34inline GBDATA *GB_HEADER_LIST_GBD(gb_header_list& hl) {
35    return GB_RESOLVE(GBDATA*, (&(hl)), rel_hl_gbd);
36}
37inline void SET_GB_HEADER_LIST_GBD(gb_header_list& hl, GBDATA *gbd) {
38    GB_SETREL(&hl, rel_hl_gbd, gbd);
39}
40
41inline gb_header_flags& GB_ARRAY_FLAGS(GBDATA *gbd) {
42    return GB_DATA_LIST_HEADER(GB_FATHER(gbd)->d)[gbd->index].flags;
43}
44inline gb_header_flags& GB_ARRAY_FLAGS(GBCONTAINER *gbc) {
45    return GB_DATA_LIST_HEADER(GB_FATHER(gbc)->d)[gbc->index].flags;
46}
47
48// ---------------------------------
49//      container element access
50
51inline GBDATA *EXISTING_GBCONTAINER_ELEM(GBCONTAINER *gbc, int idx) {
52    return GB_HEADER_LIST_GBD(GB_DATA_LIST_HEADER((gbc)->d)[idx]);
53}
54inline GBDATA *GBCONTAINER_ELEM(GBCONTAINER *gbc, int idx) {
55    return (idx<gbc->d.nheader) ? EXISTING_GBCONTAINER_ELEM(gbc, idx) : (GBDATA*)NULL;
56}
57inline void SET_GBCONTAINER_ELEM(GBCONTAINER *gbc, int idx, GBDATA *gbd) {
58    SET_GB_HEADER_LIST_GBD(GB_DATA_LIST_HEADER(gbc->d)[idx], gbd);
59}
60
61
62#else
63#error gb_header.h included twice
64#endif // GB_HEADER_H
Note: See TracBrowser for help on using the repository browser.