00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012
00013 #ifndef LTI_SAMPLE_H
00014 #define LTI_SAMPLE_H
00015
00016
00017 #include "lti_types.h"
00018
00019 LT_BEGIN_NAMESPACE(LizardTech)
00020
00021
00028 class LTISample
00029 {
00030 public:
00042 LTISample(lt_uint16 srcBandIndex,
00043 LTIColor color,
00044 LTIDataType dataType,
00045 const void *data = NULL);
00046
00047 LTISample();
00048
00052 LTISample(const LTISample&);
00053
00057 virtual ~LTISample();
00058
00062 virtual LTISample& operator=(const LTISample&);
00063
00067 bool operator==(const LTISample&) const;
00068
00072 bool operator!=(const LTISample&) const;
00073
00081 lt_uint16 getSourceBandIndex() const;
00082
00090 LTIDataType getDataType() const;
00091
00099 LTIColor getColor() const;
00100
00112 void setPrecision(lt_uint32 precision);
00113
00121 lt_uint32 getPrecision() const;
00122
00132 lt_uint32 getNumBytes() const;
00133
00143 LT_STATUS checkImpedance(const LTISample& sample) const;
00144
00150 bool isValueMin() const;
00151
00157 bool isValueMax() const;
00158
00164 void setValueToMin();
00165
00171 void setValueToMax();
00172
00179 void setValueToMin(const LTISample&);
00180
00187 void setValueToMax(const LTISample&);
00188
00197 void setValueAddr(const void*);
00198 const void* getValueAddr() const;
00199
00200 void setValueUint8(lt_uint8);
00201 void setValueUint16(lt_uint16);
00202 void setValueUint32(lt_uint32);
00203 void setValueSint8(lt_int8);
00204 void setValueSint16(lt_int16);
00205 void setValueSint32(lt_int32);
00206 void setValueFloat32(float);
00207 void setValueFloat64(double);
00208
00209 lt_uint8 getValueUint8() const;
00210 lt_uint16 getValueUint16() const;
00211 lt_uint32 getValueUint32() const;
00212 lt_int8 getValueSint8() const;
00213 lt_int16 getValueSint16() const;
00214 lt_int32 getValueSint32() const;
00215 float getValueFloat32() const;
00216 double getValueFloat64() const;
00217
00218 LT_STATUS setValueFromDouble(double);
00219 double getValueAsDouble() const;
00222 protected:
00223 friend class LTIPixel;
00224 void setColor(LTIColor color);
00225
00226 private:
00227 union ValueType
00228 {
00229 lt_uint8 uint8;
00230 lt_uint16 uint16;
00231 lt_uint32 uint32;
00232
00233 lt_int8 sint8;
00234 lt_int16 sint16;
00235 lt_int32 sint32;
00236
00237 float float32;
00238 double float64;
00239
00240
00241
00242 };
00243
00244 lt_uint16 m_srcIndex;
00245 LTIDataType m_dataType;
00246 LTIColor m_color;
00247 lt_uint32 m_numBytes;
00248 lt_uint32 m_precision;
00249 ValueType m_value;
00250 };
00251
00252
00253 LT_END_NAMESPACE(LizardTech)
00254
00255 #endif // LTI_SAMPLE_H