| 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 | } |
|---|
| 30 | ~OrgInfo() { |
|---|
| 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 (has_content(source) || |
|---|
| 50 | has_content(cultcoll) || |
|---|
| 51 | has_content(formname) || |
|---|
| 52 | has_content(nickname) || |
|---|
| 53 | has_content(commname) || |
|---|
| 54 | has_content(hostorg)); |
|---|
| 55 | } |
|---|
| 56 | }; |
|---|
| 57 | |
|---|
| 58 | struct SeqInfo : virtual Noncopyable { |
|---|
| 59 | char comp3; // yes or no, y/n |
|---|
| 60 | char comp5; // yes or no, y/n |
|---|
| 61 | |
|---|
| 62 | char *RDPid; |
|---|
| 63 | char *gbkentry; |
|---|
| 64 | char *methods; |
|---|
| 65 | |
|---|
| 66 | SeqInfo() { |
|---|
| 67 | comp3 = ' '; |
|---|
| 68 | comp5 = ' '; |
|---|
| 69 | RDPid = no_content(); |
|---|
| 70 | gbkentry = no_content(); |
|---|
| 71 | methods = no_content(); |
|---|
| 72 | } |
|---|
| 73 | ~SeqInfo() { |
|---|
| 74 | freenull(RDPid); |
|---|
| 75 | freenull(gbkentry); |
|---|
| 76 | freenull(methods); |
|---|
| 77 | } |
|---|
| 78 | void set_content_from(const SeqInfo& other) { |
|---|
| 79 | comp3 = other.comp3; |
|---|
| 80 | comp5 = other.comp5; |
|---|
| 81 | copy_content(RDPid, other.RDPid); |
|---|
| 82 | copy_content(gbkentry, other.gbkentry); |
|---|
| 83 | copy_content(methods, other.methods); |
|---|
| 84 | } |
|---|
| 85 | bool exists() const { |
|---|
| 86 | return |
|---|
| 87 | comp3 != ' ' || |
|---|
| 88 | comp5 != ' ' || |
|---|
| 89 | has_content(RDPid) || |
|---|
| 90 | has_content(gbkentry) || |
|---|
| 91 | has_content(methods); |
|---|
| 92 | } |
|---|
| 93 | }; |
|---|
| 94 | |
|---|
| 95 | struct RDP_comments : virtual Noncopyable { |
|---|
| 96 | OrgInfo orginf; |
|---|
| 97 | SeqInfo seqinf; |
|---|
| 98 | char *others; |
|---|
| 99 | |
|---|
| 100 | RDP_comments() : others(NULL) {} |
|---|
| 101 | ~RDP_comments() { freenull(others); } |
|---|
| 102 | |
|---|
| 103 | void set_content_from(const RDP_comments& other) { |
|---|
| 104 | orginf.set_content_from(other.orginf); |
|---|
| 105 | seqinf.set_content_from(other.seqinf); |
|---|
| 106 | copy_content(others, other.others); |
|---|
| 107 | } |
|---|
| 108 | bool exists() const { return orginf.exists() || seqinf.exists() || has_content(others); } |
|---|
| 109 | }; |
|---|
| 110 | |
|---|
| 111 | #else |
|---|
| 112 | #error rdp_info.h included twice |
|---|
| 113 | #endif // RDP_INFO_H |
|---|