00001
00024 #ifndef INC_SPATMOD_IMAGESAMPLE_H
00025 #define INC_SPATMOD_IMAGESAMPLE_H
00026
00027 #ifndef INC_SPATMOD_DATATYPE_H
00028 #include <spatmod/datatype.h>
00029 #endif
00030
00031 namespace SPATMOD {
00032 namespace IMAGE {
00033
00034
00035
00040 class SAMPLE {
00041
00042 public:
00043
00045 enum TYPE {
00046 TYPE_Invalid = 0,
00047 TYPE_Unknown = 1,
00048 TYPE_Index = 2,
00049 TYPE_Gray = 3,
00050 TYPE_Red = 4,
00051 TYPE_Green = 5,
00052 TYPE_Blue = 6,
00053 TYPE_Opacity = 7,
00054 TYPE_Cyan = 8,
00055 TYPE_Magenta = 9,
00056 TYPE_Yellow = 10,
00057 TYPE_Black = 11,
00058 TYPE_Hue = 12,
00059 TYPE_Saturation = 13,
00060 TYPE_ComplexMagnitude = 14,
00061 TYPE_ComplexPhase = 15,
00062 TYPE_ComplexReal = 16,
00063 TYPE_ComplexImaginary = 17,
00064 TYPE_Validity = 18,
00065 };
00066
00068 SAMPLE ();
00069
00071 SAMPLE (
00072 const SAMPLE& rhs
00073 );
00074
00076 SAMPLE (
00077 TYPE SampleType,
00078 DATATYPE DataType,
00079 const void* pValue = 0
00080 );
00081
00083 ~SAMPLE ();
00084
00086 SAMPLE& operator= (
00087 const SAMPLE& rhs
00088 );
00089
00093 int CompareValues (
00094 const SAMPLE& rhs
00095 ) const;
00096
00098 void Exchange (
00099 SAMPLE& other
00100 );
00101
00103 DATATYPE GetDataType (
00104 ) const { return (m_DataType); }
00105
00107 UINT32 GetNumBytes (
00108 ) const { return (m_DataType & DATATYPE_MASK_Size); }
00109
00112 UINT16 GetPrecision (
00113 ) const { return (m_Precision); }
00114
00116 TYPE GetType (
00117 ) const { return (m_SampleType); }
00118
00121 double GetValueDouble (
00122 ) const;
00123
00126 INT32 GetValueINT32 (
00127 ) const;
00128
00131 const void* GetValuePtr (
00132 ) const { return (m_pValue); }
00133
00136 void SetDataType (
00137 DATATYPE DataType
00138 );
00139
00145 void SetPrecision (
00146 int precision
00147 );
00148
00150 void SetType (
00151 TYPE SampleType
00152 ) { m_SampleType = SampleType; }
00153
00156 void SetValue (
00157 double value
00158 );
00159
00163 void SetValueFromPtr (
00164 const void *pValue
00165 );
00166
00168 void SetValueMaximum (
00169 );
00170
00172 void SetValueMinimum (
00173 );
00174
00177 void SetValueNAN (
00178 );
00179
00181 void SetValueZero (
00182 );
00183
00185 bool IsEqual (
00186 const SAMPLE& rhs
00187 ) const;
00188
00189 private:
00190 #ifndef GENERATING_DOXYGEN_OUTPUT
00191
00192 void *m_pValue;
00193 TYPE m_SampleType;
00194 DATATYPE m_DataType;
00195 UINT16 m_Precision;
00196
00197 #endif // GENERATING_DOXYGEN_OUTPUT
00198 };
00199
00201 inline bool operator== (
00202 const SAMPLE& lhs,
00203 const SAMPLE& rhs
00204 ) { return (lhs.IsEqual(rhs)); }
00205
00207 inline bool operator!= (
00208 const SAMPLE& lhs,
00209 const SAMPLE& rhs
00210 ) { return (!lhs.IsEqual(rhs)); }
00211
00212
00213
00214 }
00215 }
00216
00217 #endif // INC_SPATMOD_IMAGESAMPLE_H