ARB
input_format.h
Go to the documentation of this file.
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 
38 
39 #else
40 #error input_format.h included twice
41 #endif // INPUT_FORMAT_H
Format
Definition: fun.h:10
SmartPtr< InputFormat > InputFormatPtr
Definition: input_format.h:36
Format format() const OVERRIDE=0
~InputFormat() OVERRIDE
Definition: input_format.h:25
virtual ~OutputFormat()
Definition: input_format.h:14
Generic smart pointer.
Definition: smartptr.h:149
const char * get_id() const
Definition: input_format.h:30
virtual Format format() const =0
virtual void reinit()=0
#define OVERRIDE
Definition: cxxforward.h:93
#define NULp
Definition: cxxforward.h:97
SmartPtr< OutputFormat > OutputFormatPtr
Definition: input_format.h:37