source: tags/svn.1.5.4/ARBDB/gb_ts.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.0 KB
Line 
1// =============================================================== //
2//                                                                 //
3//   File      : gb_ts.h                                           //
4//   Purpose   : gb_transaction_save                               //
5//                                                                 //
6//   Institute of Microbiology (Technical University Munich)       //
7//   http://www.arb-home.de/                                       //
8//                                                                 //
9// =============================================================== //
10
11#ifndef GB_TS_H
12#define GB_TS_H
13
14#ifndef GB_DATA_H
15#include "gb_data.h"
16#endif
17
18
19struct GB_INTern_strings2 {
20    char          data[SIZOFINTERN];
21    unsigned char memsize;
22    unsigned char size;
23};
24
25struct GB_INTern2 {
26    char data[SIZOFINTERN];
27};
28
29struct gb_extern_data2 {
30    char *data;
31    long  memsize;
32    long  size;
33};
34
35union gb_data_base_type_union2 {
36    GB_INTern_strings2 istr;
37    GB_INTern2         in;
38    gb_extern_data2    ex;
39};
40
41struct gb_transaction_save {
42    gb_flag_types            flags;
43    gb_flag_types2           flags2;
44    gb_data_base_type_union2 info;
45    short                    refcount;              // number of references to this object
46};
47
48inline GB_TYPES GB_TYPE_TS(gb_transaction_save *ts)   { return GB_TYPES(ts->flags.type); }
49inline long GB_GETSIZE_TS(gb_transaction_save *ts)    { return ts->flags2.extern_data ? ts->info.ex.size     : ts->info.istr.size; }
50inline long GB_GETMEMSIZE_TS(gb_transaction_save *ts) { return ts->flags2.extern_data ? ts->info.ex.memsize  : ts->info.istr.memsize; }
51inline char *GB_GETDATA_TS(gb_transaction_save *ts)   { return ts->flags2.extern_data ? ts->info.ex.data     : &(ts->info.istr.data[0]); }
52
53inline void GB_FREE_TRANSACTION_SAVE(GBDATA *gbd) {
54    if (gbd->ext && gbd->ext->old) {
55        gb_del_ref_gb_transaction_save(gbd->ext->old);
56        gbd->ext->old = NULL;
57    }
58}
59
60#else
61#error gb_ts.h included twice
62#endif // GB_TS_H
Note: See TracBrowser for help on using the repository browser.