| 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 | |
|---|
| 11 | class FormatReader; |
|---|
| 12 | |
|---|
| 13 | struct OutputFormat { |
|---|
| 14 | virtual ~OutputFormat() { } |
|---|
| 15 | virtual Format format() const = 0; |
|---|
| 16 | }; |
|---|
| 17 | |
|---|
| 18 | // all input formats have to be output formats: |
|---|
| 19 | class InputFormat : public OutputFormat, virtual Noncopyable { |
|---|
| 20 | mutable char *id; // id of entry (=short-name) |
|---|
| 21 | |
|---|
| 22 | virtual char *create_id() const = 0; |
|---|
| 23 | public: |
|---|
| 24 | InputFormat() : id(NULp) {} |
|---|
| 25 | ~InputFormat() OVERRIDE { freenull(id); } |
|---|
| 26 | |
|---|
| 27 | virtual void reinit() = 0; |
|---|
| 28 | Format format() const OVERRIDE = 0; |
|---|
| 29 | |
|---|
| 30 | const char *get_id() const { |
|---|
| 31 | if (!id) id = create_id(); |
|---|
| 32 | return id; |
|---|
| 33 | } |
|---|
| 34 | }; |
|---|
| 35 | |
|---|
| 36 | typedef SmartPtr<InputFormat> InputFormatPtr; |
|---|
| 37 | typedef SmartPtr<OutputFormat> OutputFormatPtr; |
|---|
| 38 | |
|---|
| 39 | #else |
|---|
| 40 | #error input_format.h included twice |
|---|
| 41 | #endif // INPUT_FORMAT_H |
|---|
Note: See
TracBrowser
for help on using the repository browser.