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 | |
---|
19 | struct GB_INTern_strings2 { |
---|
20 | char data[SIZOFINTERN]; |
---|
21 | unsigned char memsize; |
---|
22 | unsigned char size; |
---|
23 | }; |
---|
24 | |
---|
25 | struct GB_INTern2 { |
---|
26 | char data[SIZOFINTERN]; |
---|
27 | }; |
---|
28 | |
---|
29 | struct gb_extern_data2 { |
---|
30 | char *data; |
---|
31 | long memsize; |
---|
32 | long size; |
---|
33 | }; |
---|
34 | |
---|
35 | union gb_data_base_type_union2 { |
---|
36 | GB_INTern_strings2 istr; |
---|
37 | GB_INTern2 in; |
---|
38 | gb_extern_data2 ex; |
---|
39 | }; |
---|
40 | |
---|
41 | struct 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 | bool stored_external() const { return flags2.extern_data; } |
---|
48 | }; |
---|
49 | |
---|
50 | inline GB_TYPES GB_TYPE_TS(gb_transaction_save *ts) { return GB_TYPES(ts->flags.type); } |
---|
51 | inline long GB_GETSIZE_TS(gb_transaction_save *ts) { return ts->stored_external() ? ts->info.ex.size : ts->info.istr.size; } |
---|
52 | inline long GB_GETMEMSIZE_TS(gb_transaction_save *ts) { return ts->stored_external() ? ts->info.ex.memsize : ts->info.istr.memsize; } |
---|
53 | inline char *GB_GETDATA_TS(gb_transaction_save *ts) { return ts->stored_external() ? ts->info.ex.data : &(ts->info.istr.data[0]); } |
---|
54 | |
---|
55 | inline void GB_FREE_TRANSACTION_SAVE(GBDATA *gbd) { |
---|
56 | if (gbd->ext && gbd->ext->old) { |
---|
57 | gb_del_ref_gb_transaction_save(gbd->ext->old); |
---|
58 | gbd->ext->old = NULp; |
---|
59 | } |
---|
60 | } |
---|
61 | |
---|
62 | #else |
---|
63 | #error gb_ts.h included twice |
---|
64 | #endif // GB_TS_H |
---|
Note: See
TracBrowser
for help on using the repository browser.