ARB
gb_localdata.h
Go to the documentation of this file.
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 
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:
52  char *write_buffer;
53  char *write_ptr;
55  long write_free;
56  bool iamclient;
58 
61 
62  long bc_size;
63 
65 
67 
68  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 
gb_buffer buf1
Definition: gb_localdata.h:51
bool search_system_folder
Definition: gb_localdata.h:57
gb_compress_tree * bituncompress
Definition: gb_localdata.h:59
gb_local_data * gb_local
Definition: arbdb.cxx:33
char * mem
Definition: gb_localdata.h:27
void announce_db_close(GB_MAIN_TYPE *Main)
Definition: arbdb.cxx:562
gb_compress_list * bitcompress
Definition: gb_localdata.h:60
size_t size
Definition: gb_localdata.h:28
int open_dbs() const
Definition: gb_localdata.h:71
gb_exitfun * atgbexit
Definition: gb_localdata.h:66
char * write_buffer
Definition: gb_localdata.h:52
ARB_TRANS_TYPE running_client_transaction
Definition: gb_localdata.h:64
char * write_ptr
Definition: gb_localdata.h:53
long write_bufsize
Definition: gb_localdata.h:54
~gb_local_data()
Definition: arbdb.cxx:434
void announce_db_open(GB_MAIN_TYPE *Main)
Definition: arbdb.cxx:550
gb_buffer buf2
Definition: gb_localdata.h:51
#define NULp
Definition: cxxforward.h:116
ARB_TRANS_TYPE
Definition: gb_localdata.h:31
GB_MAIN_TYPE * get_any_open_db()
Definition: gb_localdata.h:75