ARB
phylo.hxx
Go to the documentation of this file.
1 // =============================================================== //
2 // //
3 // File : phylo.hxx //
4 // Purpose : //
5 // //
6 // Institute of Microbiology (Technical University Munich) //
7 // http://www.arb-home.de/ //
8 // //
9 // =============================================================== //
10 
11 #ifndef PHYLO_HXX
12 #define PHYLO_HXX
13 
14 #ifndef PH_FILTER_HXX
15 #include "PH_filter.hxx"
16 #endif
17 #ifndef AW_BASE_HXX
18 #include <aw_base.hxx>
19 #endif
20 #ifndef ARB_ASSERT_H
21 #include <arb_assert.h>
22 #endif
23 
24 #define ph_assert(cond) arb_assert(cond)
25 
26 #define AWAR_PHYLO_ALIGNMENT "tmp/phyl/alignment"
27 #define AWAR_PHYLO_FILTER_FILTER "phyl/filter/filter"
28 
29 #define AWAR_PHYLO_FILTER_STARTCOL "phyl/filter/startcol"
30 #define AWAR_PHYLO_FILTER_STOPCOL "phyl/filter/stopcol"
31 #define AWAR_PHYLO_FILTER_MINHOM "phyl/filter/minhom"
32 #define AWAR_PHYLO_FILTER_MAXHOM "phyl/filter/maxhom"
33 #define AWAR_PHYLO_FILTER_DOT "phyl/filter/point"
34 #define AWAR_PHYLO_FILTER_MINUS "phyl/filter/minus"
35 #define AWAR_PHYLO_FILTER_AMBIG "phyl/filter/rest"
36 #define AWAR_PHYLO_FILTER_LOWER "phyl/filter/lower"
37 #define AWAR_PHYLO_FILTER_AUTOCALC "phyl/filter/autocalc"
38 
39 #define AWAR_PHYLO_MARKERLINENAME "tmp/phylo/markerlinename"
40 
41 enum FilterMode {
48 
49  // Note: enum values are saved in properties (do not modify w/o need!)
50  // update on changes: PH_main.cxx@filter_text
51 };
53 
54 
55 #define PH_DB_CACHE_SIZE 2000000
56 
57 enum {
62 };
63 
64 enum {
67 };
68 
69 void PH_create_filter_variables(AW_root *aw_root, AW_default default_file, GBDATA *gb_main);
71 
73  DISP_NONE, // initial
74  DISP_SPECIES, // after startup, filter not calculated yet
75  DISP_FILTER, // after filter has been calculated
76 };
77 
78 // ---------------------------
79 // class definitions
80 
81 class PH_root : virtual Noncopyable {
82  char *use;
83  GBDATA *gb_main;
84 
85  static PH_root *SINGLETON;
86 
87 public:
88 
89  PH_root() :
90  use(NULp),
91  gb_main(NULp)
92  {
93  ph_assert(!SINGLETON);
94  SINGLETON = this;
95  }
97  ph_assert(this == SINGLETON);
98  SINGLETON = NULp;
99  free(use);
100  }
101 
102  GB_ERROR open(const char *db_server);
103  GBDATA *get_gb_main() const { ph_assert(gb_main); return gb_main; }
104 };
105 
106 
107 class PHDATA : virtual Noncopyable {
108  // connection to database
109  // pointers to all elements and important values of the database
110 
111  struct PHENTRY : virtual Noncopyable {
112  unsigned int key;
113  char *name;
114  char *full_name;
115  GBDATA *gb_species_data_ptr;
116  PHENTRY *next;
117  PHENTRY *prev;
118 
119  PHENTRY() :
120  key(0),
121  name(NULp),
122  full_name(NULp),
123  gb_species_data_ptr(NULp),
124  next(NULp),
125  prev(NULp)
126  {}
127 
128  ~PHENTRY() {
129  ph_assert(0); // @@@ why not called?
130  }
131  };
132 
133  unsigned int last_key_number;
134  long seq_len;
135 
136  AW_root *aw_root; // only link
137  PH_root *ph_root; // only link
138 
139  PHENTRY *entries;
140 
141  char *unload();
142 
143 public:
144  GBDATA *get_gb_main() { return ph_root->get_gb_main(); }
145 
146  char *use; // @@@ elim (PH_root has same field)
147 
148  PHENTRY **hash_elements;
149  unsigned int nentries; // total number of entries
150 
151  static PHDATA *ROOT; // 'global' pointer
152 
153  float *markerline;
154 
155  PHDATA(AW_root *aw_root_, PH_root *ph_root_) :
156  last_key_number(0),
157  seq_len(0),
158  aw_root(aw_root_),
159  ph_root(ph_root_),
160  entries(NULp),
161  use(NULp),
162  hash_elements(NULp),
163  nentries(0),
164  markerline(NULp)
165  {}
167  unload();
168  }
169 
170  char *load(char*& use); // open database and get pointers to it
171 
172  long get_seq_len() { return seq_len; }
173 };
174 
175 #else
176 #error phylo.hxx included twice
177 #endif // PHYLO_HXX
const char * GB_ERROR
Definition: arb_core.h:25
display_type
Definition: phylo.hxx:72
PH_root()
Definition: phylo.hxx:89
GB_ERROR open(const char *db_server)
Definition: PH_root.cxx:14
unsigned int nentries
Definition: phylo.hxx:149
AW_window * PH_create_filter_window(AW_root *aw_root)
Definition: PH_filt.cxx:408
float * markerline
Definition: phylo.hxx:153
PHENTRY ** hash_elements
Definition: phylo.hxx:148
FilterMode
Definition: phylo.hxx:41
#define ph_assert(cond)
Definition: phylo.hxx:24
char * use
Definition: phylo.hxx:146
void PH_create_filter_variables(AW_root *aw_root, AW_default default_file, GBDATA *gb_main)
Definition: PH_filt.cxx:370
GBDATA * get_gb_main()
Definition: phylo.hxx:144
~PH_root()
Definition: phylo.hxx:96
const int FILTER_MODES
Definition: phylo.hxx:52
GBDATA * get_gb_main() const
Definition: phylo.hxx:103
#define NULp
Definition: cxxforward.h:97
~PHDATA()
Definition: phylo.hxx:166
static PHDATA * ROOT
Definition: phylo.hxx:151
PHDATA(AW_root *aw_root_, PH_root *ph_root_)
Definition: phylo.hxx:155
char * load(char *&use)
Definition: PH_data.cxx:28
long get_seq_len()
Definition: phylo.hxx:172
GBDATA * gb_main
Definition: adname.cxx:33