00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef HxImgFileReader_h
00011 #define HxImgFileReader_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 HxImgFileReader {
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 HxImgFileReader();
00041 HxImgFileReader(HxString suffix);
00042 virtual ~HxImgFileReader();
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
00054 virtual int imageCount() const = 0;
00055 virtual bool setImage(int img) = 0;
00056 virtual HxImageSignature getSignature() = 0;
00057 virtual HxSizes getImageSize() = 0;
00058 virtual void getInfo(HxTagList&) = 0;
00059
00060 virtual bool moreData() = 0;
00061 virtual HxSizes getDataSize() = 0;
00062 virtual HxPointZ getDataBegin() = 0;
00063 virtual DataType getDataType() = 0;
00064 virtual HxString getDataTypeString() = 0;
00065 virtual void* getData() = 0;
00066
00067 protected:
00068
00069 void setStatus(int status);
00070 void setOk();
00071 void setError();
00072 void setOpen();
00073 void setClosed();
00074
00075 private:
00076
00077 HxImgFileReader(const HxImgFileReader&);
00078 HxImgFileReader& operator=(const HxImgFileReader&);
00079
00080 int _status;
00081 };
00082
00083 inline int
00084 HxImgFileReader::getStatus() const
00085 {
00086 return _status;
00087 }
00088
00089 inline void
00090 HxImgFileReader::setStatus(int status)
00091 {
00092 _status = status;
00093 }
00094
00095 inline bool
00096 HxImgFileReader::isOpen() const
00097 {
00098 return _status & IRD_OPEN;
00099 }
00100
00101 inline bool
00102 HxImgFileReader::isClosed() const
00103 {
00104 return (_status & IRD_CLOSED) ? true : false;
00105 }
00106
00107 inline bool
00108 HxImgFileReader::isOk() const
00109 {
00110 return !(_status & IRD_ERROR);
00111 }
00112
00113 inline bool
00114 HxImgFileReader::isError() const
00115 {
00116 return (_status & IRD_ERROR) ? true : false;
00117 }
00118
00119 inline void
00120 HxImgFileReader::setOk()
00121 {
00122 _status &= ~IRD_ERROR;
00123 }
00124
00125 inline void
00126 HxImgFileReader::setError()
00127 {
00128 _status |= IRD_ERROR;
00129 }
00130
00131 inline void
00132 HxImgFileReader::setOpen()
00133 {
00134 _status &= ~IRD_CLOSED;
00135 _status |= IRD_OPEN;
00136 }
00137
00138 inline void
00139 HxImgFileReader::setClosed()
00140 {
00141 _status &= ~IRD_OPEN;
00142 _status |= IRD_CLOSED;
00143 }
00144
00145 #endif