00001 00017 #ifndef __WRITER_H__ 00018 #define __WRITER_H__ 00019 00020 #include <exception.h> 00021 #include <octree/index_oct.h> 00022 00023 #include <stdio.h> 00024 00032 class Writer { 00033 public: 00034 // ##### Exceptions ################################################ 00035 00039 class WriterException : public Exception { 00040 public: 00042 WriterException() : Exception() {} 00044 WriterException(string msg) : Exception(msg) {} 00045 }; 00046 00050 class WriteFileException : public WriterException { 00051 public: 00053 WriteFileException(const char* fileName) 00054 : WriterException("Error writing file " + (string)fileName) {} 00055 }; 00056 00060 class FileFormatException : public WriterException { 00061 public: 00063 FileFormatException(string msg) : WriterException(msg) {} 00064 }; 00065 00066 // ###### Writer ################################################### 00070 enum FormatType {POT, 00071 XPM 00072 }; 00073 00088 static Writer* getWriter(const char* fileName) 00089 throw (FileFormatException*); 00090 00095 virtual const char* getFormatName()= 0; 00096 00101 virtual const FormatType getFormatType()= 0; 00102 00108 virtual void writeFile(IndexOct* tree) 00109 throw (WriteFileException*) = 0; 00110 00111 }; // class Writer 00112 00113 #endif // ! WRITER_H