1 | |
---|
2 | #ifndef _ALI_PT_INC_ |
---|
3 | #define _ALI_PT_INC_ |
---|
4 | |
---|
5 | #include "ali_other_stuff.hxx" |
---|
6 | #include "ali_tlist.hxx" |
---|
7 | #include "ali_sequence.hxx" |
---|
8 | #include <client.h> |
---|
9 | |
---|
10 | typedef enum {ServerMode, SpecifiedMode} ALI_PT_MODE; |
---|
11 | |
---|
12 | typedef struct { |
---|
13 | char *servername; |
---|
14 | GBDATA *gb_main; |
---|
15 | |
---|
16 | int matches_min; |
---|
17 | float percent_min; |
---|
18 | unsigned long fam_list_max; |
---|
19 | unsigned long ext_list_max; |
---|
20 | |
---|
21 | char *use_specified_family; |
---|
22 | } ALI_PT_CONTEXT; |
---|
23 | |
---|
24 | /* |
---|
25 | * class of family members |
---|
26 | */ |
---|
27 | class ali_pt_member { |
---|
28 | public: |
---|
29 | char *name; |
---|
30 | int matches; |
---|
31 | |
---|
32 | ali_pt_member(char *speciesname, int number_of_matches) { |
---|
33 | name = speciesname; |
---|
34 | matches = number_of_matches; |
---|
35 | } |
---|
36 | ~ali_pt_member(void) { |
---|
37 | if (name) |
---|
38 | free((char *) name); |
---|
39 | } |
---|
40 | }; |
---|
41 | |
---|
42 | |
---|
43 | /* |
---|
44 | * Class for accessing the PT server |
---|
45 | */ |
---|
46 | class ALI_PT { |
---|
47 | private: |
---|
48 | ALI_PT_MODE mode; |
---|
49 | |
---|
50 | char *specified_family; |
---|
51 | unsigned long fam_list_max; |
---|
52 | unsigned long ext_list_max; |
---|
53 | float percent_min; |
---|
54 | int matches_min; |
---|
55 | |
---|
56 | aisc_com *link; |
---|
57 | T_PT_LOCS locs; |
---|
58 | T_PT_MAIN com; |
---|
59 | |
---|
60 | ALI_TLIST<ali_pt_member *> *family_list; |
---|
61 | ALI_TLIST<ali_pt_member *> *extension_list; |
---|
62 | |
---|
63 | |
---|
64 | int init_communication(void); |
---|
65 | char *get_family_member(char *specified_family, unsigned long number); |
---|
66 | char *get_extension_member(char *specified_family, unsigned long number); |
---|
67 | int open(char *servername,GBDATA *gb_main); |
---|
68 | void close(void); |
---|
69 | |
---|
70 | public: |
---|
71 | ALI_PT(ALI_PT_CONTEXT *context); |
---|
72 | ~ALI_PT(void); |
---|
73 | |
---|
74 | int find_family(ALI_SEQUENCE *sequence, int find_type = 1); |
---|
75 | |
---|
76 | ALI_TLIST<ali_pt_member *> *get_family_list(); |
---|
77 | ALI_TLIST<ali_pt_member *> *get_extension_list(); |
---|
78 | |
---|
79 | int first_family_(char **seq_name, int *matches); |
---|
80 | int next_family_(char **seq_name, int *matches); |
---|
81 | }; |
---|
82 | |
---|
83 | #endif |
---|