00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PNMFILETYPEALIAS_H
00020 #define PNMFILETYPEALIAS_H
00021
00022 #include "pandabase.h"
00023
00024 #include "pnmFileType.h"
00025 #include "pnmReader.h"
00026 #include "pnmWriter.h"
00027
00028
00029
00030
00031
00032 class EXPCL_PANDA PNMFileTypeAlias : public PNMFileType {
00033 public:
00034 PNMFileTypeAlias();
00035
00036 virtual string get_name() const;
00037
00038 virtual int get_num_extensions() const;
00039 virtual string get_extension(int n) const;
00040 virtual string get_suggested_extension() const;
00041
00042 virtual PNMReader *make_reader(istream *file, bool owns_file = true,
00043 const string &magic_number = string());
00044 virtual PNMWriter *make_writer(ostream *file, bool owns_file = true);
00045
00046 public:
00047 class Reader : public PNMReader {
00048 public:
00049 Reader(PNMFileType *type, istream *file, bool owns_file, string magic_number);
00050
00051 virtual bool supports_read_row() const;
00052 virtual bool read_row(xel *array, xelval *alpha);
00053 };
00054
00055 class Writer : public PNMWriter {
00056 public:
00057 Writer(PNMFileType *type, ostream *file, bool owns_file);
00058
00059 virtual bool supports_write_row() const;
00060 virtual bool write_header();
00061 virtual bool write_row(xel *array, xelval *alpha);
00062 };
00063
00064
00065
00066 public:
00067 static void register_with_read_factory();
00068
00069 protected:
00070 static TypedWritable *make_PNMFileTypeAlias(const FactoryParams ¶ms);
00071
00072 public:
00073 static TypeHandle get_class_type() {
00074 return _type_handle;
00075 }
00076 static void init_type() {
00077 PNMFileType::init_type();
00078 register_type(_type_handle, "PNMFileTypeAlias",
00079 PNMFileType::get_class_type());
00080 }
00081 virtual TypeHandle get_type() const {
00082 return get_class_type();
00083 }
00084 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00085
00086 private:
00087 static TypeHandle _type_handle;
00088 };
00089
00090 #endif
00091
00092