Line | |
---|
1 | // =============================================================== // |
---|
2 | // // |
---|
3 | // File : gb_localdata.h // |
---|
4 | // Purpose : // |
---|
5 | // // |
---|
6 | // Institute of Microbiology (Technical University Munich) // |
---|
7 | // http://www.arb-home.de/ // |
---|
8 | // // |
---|
9 | // =============================================================== // |
---|
10 | |
---|
11 | #ifndef GB_LOCALDATA_H |
---|
12 | #define GB_LOCALDATA_H |
---|
13 | |
---|
14 | #ifndef _GLIBCXX_CSTDDEF |
---|
15 | #include <cstddef> |
---|
16 | #endif |
---|
17 | #ifndef ARBTOOLS_H |
---|
18 | #include <arbtools.h> |
---|
19 | #endif |
---|
20 | |
---|
21 | struct GBDATA; |
---|
22 | struct GB_MAIN_TYPE; |
---|
23 | struct gb_compress_tree; |
---|
24 | struct gb_compress_list; |
---|
25 | |
---|
26 | struct gb_buffer { |
---|
27 | char *mem; |
---|
28 | size_t size; |
---|
29 | }; |
---|
30 | |
---|
31 | enum ARB_TRANS_TYPE { |
---|
32 | ARB_COMMIT, |
---|
33 | ARB_ABORT, |
---|
34 | ARB_TRANS, |
---|
35 | ARB_NO_TRANS |
---|
36 | }; |
---|
37 | |
---|
38 | struct gb_exitfun; |
---|
39 | |
---|
40 | class gb_local_data : virtual Noncopyable { |
---|
41 | // global data structure used for all open databases |
---|
42 | // @@@ could be moved into GB_shell |
---|
43 | |
---|
44 | GB_MAIN_TYPE **open_gb_mains; |
---|
45 | int open_gb_alloc; |
---|
46 | |
---|
47 | int openedDBs; |
---|
48 | int closedDBs; |
---|
49 | |
---|
50 | public: |
---|
51 | gb_buffer buf1, buf2; |
---|
52 | char *write_buffer; |
---|
53 | char *write_ptr; |
---|
54 | long write_bufsize; |
---|
55 | long write_free; |
---|
56 | bool iamclient; |
---|
57 | bool search_system_folder; |
---|
58 | |
---|
59 | gb_compress_tree *bituncompress; |
---|
60 | gb_compress_list *bitcompress; |
---|
61 | |
---|
62 | long bc_size; |
---|
63 | |
---|
64 | ARB_TRANS_TYPE running_client_transaction; |
---|
65 | |
---|
66 | gb_exitfun *atgbexit; |
---|
67 | |
---|
68 | gb_local_data(); |
---|
69 | ~gb_local_data(); |
---|
70 | |
---|
71 | int open_dbs() const { return openedDBs-closedDBs; } |
---|
72 | |
---|
73 | void announce_db_open(GB_MAIN_TYPE *Main); |
---|
74 | void announce_db_close(GB_MAIN_TYPE *Main); |
---|
75 | GB_MAIN_TYPE *get_any_open_db() { int idx = open_dbs(); return idx ? open_gb_mains[idx-1] : NULp; } |
---|
76 | |
---|
77 | #if defined(UNIT_TESTS) // UT_DIFF |
---|
78 | void fake_closed_DBs() { |
---|
79 | closedDBs = openedDBs; |
---|
80 | } |
---|
81 | #endif |
---|
82 | }; |
---|
83 | |
---|
84 | extern gb_local_data *gb_local; |
---|
85 | |
---|
86 | #else |
---|
87 | #error gb_localdata.h included twice |
---|
88 | #endif // GB_LOCALDATA_H |
---|
89 | |
---|
Note: See
TracBrowser
for help on using the repository browser.