root/trunk/CONVERTALN/input_format.h

Revision 7623, 0.9 KB (checked in by westram, 12 months 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
Line 
1#ifndef INPUT_FORMAT_H
2#define INPUT_FORMAT_H
3
4#ifndef SEQ_H
5#include "seq.h"
6#endif
7#ifndef DEFS_H
8#include "defs.h"
9#endif
10
11class FormatReader;
12
13class OutputFormat {
14public:
15    virtual ~OutputFormat() { }
16    virtual Format format() const = 0;
17};
18
19// all input formats have to be output formats:
20class InputFormat : public OutputFormat, virtual Noncopyable {
21    mutable char *id; // id of entry (=short-name)
22
23    virtual char *create_id() const = 0;
24public:
25    InputFormat() : id(NULL) {}
26    virtual ~InputFormat() { freenull(id); }
27
28    virtual void reinit()           = 0;
29    virtual Format format() const   = 0;
30
31    const char *get_id() const {
32        if (!id) id = create_id();
33        return id;
34    }
35};
36
37typedef SmartPtr<InputFormat> InputFormatPtr;
38typedef SmartPtr<OutputFormat> OutputFormatPtr;
39
40#else
41#error input_format.h included twice
42#endif // INPUT_FORMAT_H
Note: See TracBrowser for help on using the browser.