File: input_format.h

package info (click to toggle)
arb 6.0.6-8
  • links: PTS, VCS
  • area: non-free
  • in suites: sid, trixie
  • size: 66,204 kB
  • sloc: ansic: 394,911; cpp: 250,290; makefile: 19,644; sh: 15,879; perl: 10,473; fortran: 6,019; ruby: 683; xml: 503; python: 53; awk: 32
file content (41 lines) | stat: -rw-r--r-- 900 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef INPUT_FORMAT_H
#define INPUT_FORMAT_H

#ifndef SEQ_H
#include "seq.h"
#endif
#ifndef DEFS_H
#include "defs.h"
#endif

class FormatReader;

struct OutputFormat {
    virtual ~OutputFormat() { }
    virtual Format format() const = 0;
};

// all input formats have to be output formats:
class InputFormat : public OutputFormat, virtual Noncopyable {
    mutable char *id; // id of entry (=short-name)

    virtual char *create_id() const = 0;
public:
    InputFormat() : id(NULL) {}
    virtual ~InputFormat() OVERRIDE { freenull(id); }

    virtual void reinit()                  = 0;
    virtual Format format() const OVERRIDE = 0;

    const char *get_id() const {
        if (!id) id = create_id();
        return id;
    }
};

typedef SmartPtr<InputFormat> InputFormatPtr;
typedef SmartPtr<OutputFormat> OutputFormatPtr;

#else
#error input_format.h included twice
#endif // INPUT_FORMAT_H