ARB
rdp_info.h
Go to the documentation of this file.
1 #ifndef RDP_INFO_H
2 #define RDP_INFO_H
3 
4 #ifndef GLOBAL_H
5 #include "global.h"
6 #endif
7 #ifndef FUN_H
8 #include "fun.h"
9 #endif
10 
11 // -------------------------------
12 // RDP-defined comments (Embl+GenBank)
13 
14 struct OrgInfo : virtual Noncopyable {
15  char *source;
16  char *cultcoll;
17  char *formname;
18  char *nickname;
19  char *commname;
20  char *hostorg;
21 
22  OrgInfo() {
23  source = no_content();
24  cultcoll = no_content();
25  formname = no_content();
26  nickname = no_content();
27  commname = no_content();
28  hostorg = no_content();
29  }
31  freenull(source);
32  freenull(cultcoll);
33  freenull(formname);
34  freenull(nickname);
35  freenull(commname);
36  freenull(hostorg);
37  }
38 
39  void set_content_from(const OrgInfo& other) {
40  copy_content(source, other.source);
41  copy_content(cultcoll, other.cultcoll);
42  copy_content(formname, other.formname);
43  copy_content(nickname, other.nickname);
44  copy_content(commname, other.commname);
45  copy_content(hostorg, other.hostorg);
46  }
47 
48  bool exists() const {
49  return
50  has_content(source) ||
51  has_content(cultcoll) ||
52  has_content(formname) ||
53  has_content(nickname) ||
54  has_content(commname) ||
55  has_content(hostorg);
56  }
57 };
58 
59 struct SeqInfo : virtual Noncopyable {
60  char comp3; // yes or no, y/n
61  char comp5; // yes or no, y/n
62 
63  char *RDPid;
64  char *gbkentry;
65  char *methods;
66 
67  SeqInfo() {
68  comp3 = ' ';
69  comp5 = ' ';
70  RDPid = no_content();
71  gbkentry = no_content();
72  methods = no_content();
73  }
75  freenull(RDPid);
76  freenull(gbkentry);
77  freenull(methods);
78  }
79  void set_content_from(const SeqInfo& other) {
80  comp3 = other.comp3;
81  comp5 = other.comp5;
82  copy_content(RDPid, other.RDPid);
83  copy_content(gbkentry, other.gbkentry);
84  copy_content(methods, other.methods);
85  }
86  bool exists() const {
87  return
88  comp3 != ' ' ||
89  comp5 != ' ' ||
90  has_content(RDPid) ||
91  has_content(gbkentry) ||
92  has_content(methods);
93  }
94 };
95 
96 struct RDP_comments : virtual Noncopyable {
99  char *others;
100 
101  RDP_comments() : others(NULp) {}
102  ~RDP_comments() { freenull(others); }
103 
104  void set_content_from(const RDP_comments& other) {
105  orginf.set_content_from(other.orginf);
106  seqinf.set_content_from(other.seqinf);
107  copy_content(others, other.others);
108  }
109  bool exists() const { return orginf.exists() || seqinf.exists() || has_content(others); }
110 };
111 
112 #else
113 #error rdp_info.h included twice
114 #endif // RDP_INFO_H
char * nickname
Definition: rdp_info.h:18
char * formname
Definition: rdp_info.h:17
char * others
Definition: rdp_info.h:99
char * gbkentry
Definition: rdp_info.h:64
char * commname
Definition: rdp_info.h:19
char * source
Definition: rdp_info.h:15
CONSTEXPR_INLINE bool has_content(const char *field)
Definition: global.h:127
char comp5
Definition: rdp_info.h:61
bool copy_content(char *&entry, const char *content)
Definition: global.h:136
~SeqInfo()
Definition: rdp_info.h:74
SeqInfo seqinf
Definition: rdp_info.h:98
char comp3
Definition: rdp_info.h:60
bool exists() const
Definition: rdp_info.h:109
void set_content_from(const OrgInfo &other)
Definition: rdp_info.h:39
~OrgInfo()
Definition: rdp_info.h:30
void set_content_from(const RDP_comments &other)
Definition: rdp_info.h:104
OrgInfo orginf
Definition: rdp_info.h:97
char * hostorg
Definition: rdp_info.h:20
char * RDPid
Definition: rdp_info.h:63
OrgInfo()
Definition: rdp_info.h:22
bool exists() const
Definition: rdp_info.h:48
#define NULp
Definition: cxxforward.h:97
char * cultcoll
Definition: rdp_info.h:16
char * no_content()
Definition: global.h:129
char * methods
Definition: rdp_info.h:65
bool exists() const
Definition: rdp_info.h:86
SeqInfo()
Definition: rdp_info.h:67
void set_content_from(const SeqInfo &other)
Definition: rdp_info.h:79