38 #ifndef DATAVALUE_OBJECT_H
39 #define DATAVALUE_OBJECT_H
108 GeoTessDataValue(IFStreamAscii& ifs) : GeoTessData(), value(0)
109 { ifs.readType(value); };
114 GeoTessDataValue(IFStreamBinary& ifs, vector<int>& filter) : GeoTessData(), value(0)
117 for (
int i=0; i<(int)filter.size(); ++i)
128 GeoTessDataValue(IFStreamAscii& ifs, vector<int>& filter) : GeoTessData(), value(0)
131 for (
int i=0; i<(int)filter.size(); ++i)
142 virtual ~GeoTessDataValue() {};
144 virtual LONG_INT getMemory() {
return (
LONG_INT)
sizeof(GeoTessDataValue<T>); }
149 virtual void write(IFStreamAscii& ofs)
150 { ofs.writeString(
" "); ofs.writeType(value); };
155 virtual void write(IFStreamBinary& ofs) { ofs.writeType(value); };
167 virtual int size()
const {
return 1; };
174 {
return (GeoTessData::operator==(d) && ((value == d.value) || (isNaN(0) && d.
isNaN(0)))); }
186 {
return attributeIndex == 0 ? (double) value : NaN_DOUBLE; }
189 {
return attributeIndex == 0 ? (float) value : NaN_FLOAT; };
192 {
return attributeIndex == 0 ? (
LONG_INT) value : LONG_MIN; };
194 virtual int getInt(
int attributeIndex)
const
195 {
return attributeIndex == 0 ? (int) value : INT_MIN; };
198 {
return attributeIndex == 0 ? (short) value : SHRT_MIN; };
200 virtual byte getByte(
int attributeIndex)
const
201 {
return attributeIndex == 0 ? (
byte) value : SCHAR_MIN; };
207 virtual void getValue(
int attributeIndex,
double& val)
const
208 { val = attributeIndex == 0 ? (double) value : NaN_DOUBLE; };
213 virtual void getValue(
int attributeIndex,
float& val)
const
214 { val = attributeIndex == 0 ? (float) value : NaN_FLOAT; };
220 { val = attributeIndex == 0 ? (
LONG_INT) value : LONG_MIN; };
225 virtual void getValue(
int attributeIndex,
int& val)
const
226 { val = attributeIndex == 0 ? (int) value : INT_MIN; };
231 virtual void getValue(
int attributeIndex,
short& val)
const
232 { val = attributeIndex == 0 ? (short) value : SHRT_MIN; };
237 virtual void getValue(
int attributeIndex,
byte& val)
const
238 { val = attributeIndex == 0 ? (
byte) value : SCHAR_MIN; };
243 virtual void getValues(
double values[],
const int& n) { values[0] = (double) value; }
248 virtual void getValues(
float values[],
const int& n) { values[0] = (float) value; }
258 virtual void getValues(
int values[],
const int& n) { values[0] = (int) value; }
263 virtual void getValues(
short values[],
const int& n) { values[0] = (short) value; }
268 virtual void getValues(
byte values[],
const int& n) { values[0] = (
byte) value; }
274 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
277 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
280 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
283 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
286 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
289 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
302 virtual bool isNaN(
int attributeIndex)
const {
return false;};
320 inline bool GeoTessDataValue<double>::isNaN(
int attributeIndex)
const
322 return (isnan(value));
329 inline bool GeoTessDataValue<float>::isNaN(
int attributeIndex)
const
331 double v = (double) value;
339 inline const GeoTessDataType& GeoTessDataValue<double>::getDataType()
const
341 return GeoTessDataType::DOUBLE;
348 inline const GeoTessDataType& GeoTessDataValue<float>::getDataType()
const
350 return GeoTessDataType::FLOAT;
357 inline const GeoTessDataType& GeoTessDataValue<LONG_INT>::getDataType()
const
359 return GeoTessDataType::LONG;
366 inline const GeoTessDataType& GeoTessDataValue<int>::getDataType()
const
368 return GeoTessDataType::INT;
375 inline const GeoTessDataType& GeoTessDataValue<short>::getDataType()
const
377 return GeoTessDataType::SHORT;
384 inline const GeoTessDataType& GeoTessDataValue<byte>::getDataType()
const
386 return GeoTessDataType::BYTE;
393 #endif // DATAVALUE_OBJECT_H