00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef HxImgFileWriter_h
00011 #define HxImgFileWriter_h
00012
00013 #include "HxStd.h"
00014 #include "HxString.h"
00015 #include "HxSizes.h"
00016 #include "HxPointZ.h"
00017 #include "HxImageSignature.h"
00018
00019 class HxTagList;
00020
00021 class L_HXIMAGEREP HxImgFileWriter {
00022 public:
00023
00024 enum Status {
00025 IRD_OK = 0x0,
00026 IRD_OPEN = 0x1,
00027 IRD_CLOSED = 0x2,
00028 IRD_ERROR = 0x4};
00029 enum DataType {
00030 BYTEDATA,
00031 SHORTDATA,
00032 INTDATA,
00033 FLOATDATA,
00034 DOUBLEDATA };
00035
00036 HxImgFileWriter();
00041 HxImgFileWriter(HxString suffix);
00042 virtual ~HxImgFileWriter();
00043
00044 int getStatus() const;
00045 bool isOpen() const;
00046 bool isClosed() const;
00047 bool isOk() const;
00048 bool isError() const;
00049 virtual HxString errorDescription() const = 0;
00050
00051 virtual bool openFile(HxString fileName) = 0;
00052 virtual void closeFile() = 0;
00053
00059 virtual bool setSignature(HxImageSignature) = 0;
00060 virtual bool setImageSize(HxSizes) = 0;
00066 virtual bool setInfo(HxTagList&) = 0;
00067
00068 virtual DataType getDataType() = 0;
00069 virtual HxString getDataTypeString() = 0;
00070
00071 virtual bool moreData() = 0;
00072 virtual HxSizes getDataSize() = 0;
00073 virtual HxPointZ getDataBegin() = 0;
00075 virtual void* getData() = 0;
00077 virtual void putData(void*) = 0;
00078
00079
00080
00081
00082 virtual bool firstImage();
00083 virtual void nextImage();
00084
00085 protected:
00086
00087 void setStatus(int status);
00088 void setOk();
00089 void setError();
00090 void setOpen();
00091 void setClosed();
00092
00093 private:
00094
00095 HxImgFileWriter(const HxImgFileWriter&);
00096 HxImgFileWriter& operator=(const HxImgFileWriter&);
00097
00098 int _status;
00099 };
00100
00101 inline int
00102 HxImgFileWriter::getStatus() const
00103 {
00104 return _status;
00105 }
00106
00107 inline void
00108 HxImgFileWriter::setStatus(int status)
00109 {
00110 _status = status;
00111 }
00112
00113 inline bool
00114 HxImgFileWriter::isOpen() const
00115 {
00116 return _status & IRD_OPEN;
00117 }
00118
00119 inline bool
00120 HxImgFileWriter::isClosed() const
00121 {
00122 return (_status & IRD_CLOSED) ? true : false;
00123 }
00124
00125 inline bool
00126 HxImgFileWriter::isOk() const
00127 {
00128 return !(_status & IRD_ERROR);
00129 }
00130
00131 inline bool
00132 HxImgFileWriter::isError() const
00133 {
00134 return (_status & IRD_ERROR) ? true : false;
00135 }
00136
00137 inline void
00138 HxImgFileWriter::setOk()
00139 {
00140 _status &= ~IRD_ERROR;
00141 }
00142
00143 inline void
00144 HxImgFileWriter::setError()
00145 {
00146 _status |= IRD_ERROR;
00147 }
00148
00149 inline void
00150 HxImgFileWriter::setOpen()
00151 {
00152 _status &= ~IRD_CLOSED;
00153 _status |= IRD_OPEN;
00154 }
00155
00156 inline void
00157 HxImgFileWriter::setClosed()
00158 {
00159 _status &= ~IRD_OPEN;
00160 _status |= IRD_CLOSED;
00161 }
00162
00163 #endif