source: branches/profile/CONVERTALN/rdp_info.h

Last change on this file was 7623, checked in by westram, 13 years ago
  • merge from dev [7450] [7452] [7456] [7457] [7458] [7459] [7460] [7461] [7464] [7465] [7466] [7467] [7468] [7469] [7482]
    • tweaked compiler options
      • activated -Weffc++
        • postfilter warnings where Scott Meyers' advices are too general.
          • base classes should not always have virtual destructors, since that renders tiny classes useless and
          • members should not always be initialized via initialization list, since that often violates the DRY principle
        • fix gcc's inability to detect that Noncopyable implements a private copy-ctor and op=
        • this slows down complete ARB recompilation by ~5%
    • added -Wold-style-cast (inactive)
    • removed -Wno-non-template-friend added in [7447]
  • postcompile.pl
    • added option —original to show unmodified compiler output
  • declared op= for classes which had a copy-ctor
  • moved op= macros to arbtools.h
  • derived classes containing pointers from Noncopyable (use Noncopyable virtually) or
  • made them copyable if needed (awt_mask_item, KnownDB, Code, AWT_registered_itemtype, GEN_gene, PosGene, PartialSequence, PlugIn, Range, Convaln_exception)
  • other related changes
    • user mask destruction working now
File size: 2.8 KB
Line 
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
14struct 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
58struct 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
95struct 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
Note: See TracBrowser for help on using the repository browser.