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  void disconnect_from_db(AW_root *aw_root);
106 };
107 
108 
109 class PHDATA : virtual Noncopyable {
110  // connection to database
111  // pointers to all elements and important values of the database
112 
113  struct PHENTRY : virtual Noncopyable {
114  unsigned int key;
115  char *name;
116  char *full_name;
117  GBDATA *gb_species_data_ptr;
118  PHENTRY *next;
119  PHENTRY *prev;
120 
121  PHENTRY() :
122  key(0),
123  name(NULp),
124  full_name(NULp),
125  gb_species_data_ptr(NULp),
126  next(NULp),
127  prev(NULp)
128  {}
129 
130  ~PHENTRY() {
131  ph_assert(0); // @@@ why not called?
132  }
133  };
134 
135  unsigned int last_key_number;
136  long seq_len;
137 
138  AW_root *aw_root; // only link
139  PH_root *ph_root; // only link
140 
141  PHENTRY *entries;
142 
143  char *unload();
144 
145 public:
146  GBDATA *get_gb_main() { return ph_root->get_gb_main(); }
147 
148  char *use; // @@@ elim (PH_root has same field)
149 
150  PHENTRY **hash_elements;
151  unsigned int nentries; // total number of entries
152 
153  static PHDATA *ROOT; // 'global' pointer
154 
155  float *markerline;
156 
157  PHDATA(AW_root *aw_root_, PH_root *ph_root_) :
158  last_key_number(0),
159  seq_len(0),
160  aw_root(aw_root_),
161  ph_root(ph_root_),
162  entries(NULp),
163  use(NULp),
164  hash_elements(NULp),
165  nentries(0),
166  markerline(NULp)
167  {}
169  unload();
170  }
171 
172  char *load(char*& use); // open database and get pointers to it
173 
174  long get_seq_len() { return seq_len; }
175 };
176 
177 #else
178 #error phylo.hxx included twice
179 #endif // PHYLO_HXX
180 
const char * GB_ERROR
Definition: arb_core.h:25
void disconnect_from_db(AW_root *aw_root)
Definition: PH_main.cxx:86
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:151
AW_window * PH_create_filter_window(AW_root *aw_root)
Definition: PH_filt.cxx:416
float * markerline
Definition: phylo.hxx:155
PHENTRY ** hash_elements
Definition: phylo.hxx:150
FilterMode
Definition: phylo.hxx:41
#define ph_assert(cond)
Definition: phylo.hxx:24
char * use
Definition: phylo.hxx:148
void PH_create_filter_variables(AW_root *aw_root, AW_default default_file, GBDATA *gb_main)
Definition: PH_filt.cxx:371
GBDATA * get_gb_main()
Definition: phylo.hxx:146
~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:116
~PHDATA()
Definition: phylo.hxx:168
static PHDATA * ROOT
Definition: phylo.hxx:153
PHDATA(AW_root *aw_root_, PH_root *ph_root_)
Definition: phylo.hxx:157
char * load(char *&use)
Definition: PH_data.cxx:28
long get_seq_len()
Definition: phylo.hxx:174
GBDATA * gb_main
Definition: adname.cxx:32