36 #ifndef DATAVALUE_OBJECT_H
37 #define DATAVALUE_OBJECT_H
106 GeoTessDataValue(IFStreamAscii& ifs) : GeoTessData(), value(0)
107 { ifs.readType(value); };
112 GeoTessDataValue(IFStreamBinary& ifs, vector<int>& filter) : GeoTessData(), value(0)
115 for (
int i=0; i<(int)filter.size(); ++i)
126 GeoTessDataValue(IFStreamAscii& ifs, vector<int>& filter) : GeoTessData(), value(0)
129 for (
int i=0; i<(int)filter.size(); ++i)
140 virtual ~GeoTessDataValue() {};
145 virtual void write(IFStreamAscii& ofs)
146 { ofs.writeString(
" "); ofs.writeType(value); };
151 virtual void write(IFStreamBinary& ofs) { ofs.writeType(value); };
163 virtual int size()
const {
return 1; };
170 {
return (GeoTessData::operator==(d) && ((value == d.value) || (isNaN(0) && d.
isNaN(0)))); }
181 virtual double getDouble(
int attributeIndex)
const
182 {
return attributeIndex == 0 ? (double) value : NaN_DOUBLE; }
184 virtual float getFloat(
int attributeIndex)
const
185 {
return attributeIndex == 0 ? (float) value : NaN_FLOAT; };
188 {
return attributeIndex == 0 ? (
LONG_INT) value : LONG_MIN; };
190 virtual int getInt(
int attributeIndex)
const
191 {
return attributeIndex == 0 ? (int) value : INT_MIN; };
193 virtual short getShort(
int attributeIndex)
const
194 {
return attributeIndex == 0 ? (short) value : SHRT_MIN; };
196 virtual byte getByte(
int attributeIndex)
const
197 {
return attributeIndex == 0 ? (
byte) value : SCHAR_MIN; };
203 virtual void getValue(
int attributeIndex,
double& val)
const
204 { val = attributeIndex == 0 ? (double) value : NaN_DOUBLE; };
209 virtual void getValue(
int attributeIndex,
float& val)
const
210 { val = attributeIndex == 0 ? (float) value : NaN_FLOAT; };
215 virtual void getValue(
int attributeIndex,
LONG_INT& val)
const
216 { val = attributeIndex == 0 ? (
LONG_INT) value : LONG_MIN; };
221 virtual void getValue(
int attributeIndex,
int& val)
const
222 { val = attributeIndex == 0 ? (int) value : INT_MIN; };
227 virtual void getValue(
int attributeIndex,
short& val)
const
228 { val = attributeIndex == 0 ? (short) value : SHRT_MIN; };
233 virtual void getValue(
int attributeIndex,
byte& val)
const
234 { val = attributeIndex == 0 ? (
byte) value : SCHAR_MIN; };
239 virtual void getValues(
double values[],
const int& n) { values[0] = (double) value; }
244 virtual void getValues(
float values[],
const int& n) { values[0] = (float) value; }
254 virtual void getValues(
int values[],
const int& n) { values[0] = (int) value; }
259 virtual void getValues(
short values[],
const int& n) { values[0] = (short) value; }
270 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
273 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
276 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
279 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
282 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
285 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
298 virtual bool isNaN(
int attributeIndex)
const {
return false;};
316 inline bool GeoTessDataValue<double>::isNaN(
int attributeIndex)
const
318 return (isnan(value));
325 inline bool GeoTessDataValue<float>::isNaN(
int attributeIndex)
const
327 double v = (double) value;
335 inline const GeoTessDataType& GeoTessDataValue<double>::getDataType()
const
337 return GeoTessDataType::DOUBLE;
344 inline const GeoTessDataType& GeoTessDataValue<float>::getDataType()
const
346 return GeoTessDataType::FLOAT;
353 inline const GeoTessDataType& GeoTessDataValue<LONG_INT>::getDataType()
const
355 return GeoTessDataType::LONG;
362 inline const GeoTessDataType& GeoTessDataValue<int>::getDataType()
const
364 return GeoTessDataType::INT;
371 inline const GeoTessDataType& GeoTessDataValue<short>::getDataType()
const
373 return GeoTessDataType::SHORT;
380 inline const GeoTessDataType& GeoTessDataValue<byte>::getDataType()
const
382 return GeoTessDataType::BYTE;
389 #endif // DATAVALUE_OBJECT_H