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() {};
142 virtual LONG_INT getMemory() {
return (
LONG_INT)
sizeof(GeoTessDataValue<T>); }
147 virtual void write(IFStreamAscii& ofs)
148 { ofs.writeString(
" "); ofs.writeType(value); };
153 virtual void write(IFStreamBinary& ofs) { ofs.writeType(value); };
165 virtual int size()
const {
return 1; };
172 {
return (GeoTessData::operator==(d) && ((value == d.value) || (isNaN(0) && d.
isNaN(0)))); }
184 {
return attributeIndex == 0 ? (double) value : NaN_DOUBLE; }
187 {
return attributeIndex == 0 ? (float) value : NaN_FLOAT; };
190 {
return attributeIndex == 0 ? (
LONG_INT) value : LONG_MIN; };
192 virtual int getInt(
int attributeIndex)
const
193 {
return attributeIndex == 0 ? (int) value : INT_MIN; };
196 {
return attributeIndex == 0 ? (short) value : SHRT_MIN; };
198 virtual byte getByte(
int attributeIndex)
const
199 {
return attributeIndex == 0 ? (
byte) value : SCHAR_MIN; };
205 virtual void getValue(
int attributeIndex,
double& val)
const
206 { val = attributeIndex == 0 ? (double) value : NaN_DOUBLE; };
211 virtual void getValue(
int attributeIndex,
float& val)
const
212 { val = attributeIndex == 0 ? (float) value : NaN_FLOAT; };
218 { val = attributeIndex == 0 ? (
LONG_INT) value : LONG_MIN; };
223 virtual void getValue(
int attributeIndex,
int& val)
const
224 { val = attributeIndex == 0 ? (int) value : INT_MIN; };
229 virtual void getValue(
int attributeIndex,
short& val)
const
230 { val = attributeIndex == 0 ? (short) value : SHRT_MIN; };
235 virtual void getValue(
int attributeIndex,
byte& val)
const
236 { val = attributeIndex == 0 ? (
byte) value : SCHAR_MIN; };
241 virtual void getValues(
double values[],
const int& n) { values[0] = (double) value; }
246 virtual void getValues(
float values[],
const int& n) { values[0] = (float) value; }
256 virtual void getValues(
int values[],
const int& n) { values[0] = (int) value; }
261 virtual void getValues(
short values[],
const int& n) { values[0] = (short) value; }
266 virtual void getValues(
byte values[],
const int& n) { values[0] = (
byte) value; }
272 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
275 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
278 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
281 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
284 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
287 {
if (attributeIndex == 0) value = (T) v;
return *
this; };
300 virtual bool isNaN(
int attributeIndex)
const {
return false;};
318 inline bool GeoTessDataValue<double>::isNaN(
int attributeIndex)
const
320 return (std::isnan(value));
327 inline bool GeoTessDataValue<float>::isNaN(
int attributeIndex)
const
329 double v = (double) value;
330 return (std::isnan(v));
337 inline const GeoTessDataType& GeoTessDataValue<double>::getDataType()
const
339 return GeoTessDataType::DOUBLE;
346 inline const GeoTessDataType& GeoTessDataValue<float>::getDataType()
const
348 return GeoTessDataType::FLOAT;
355 inline const GeoTessDataType& GeoTessDataValue<LONG_INT>::getDataType()
const
357 return GeoTessDataType::LONG;
364 inline const GeoTessDataType& GeoTessDataValue<int>::getDataType()
const
366 return GeoTessDataType::INT;
373 inline const GeoTessDataType& GeoTessDataValue<short>::getDataType()
const
375 return GeoTessDataType::SHORT;
382 inline const GeoTessDataType& GeoTessDataValue<byte>::getDataType()
const
384 return GeoTessDataType::BYTE;
#define byte
signed-byte typedef
Abstract base class that manages the data values attached to a single grid point.
Enumeration of supported DataType including DOUBLE, FLOAT, LONG, INT, SHORT and BYTE.
Manages a single data value attached to a grid node.
virtual GeoTessData * copy()
virtual void getValue(int attributeIndex, int &val) const
virtual GeoTessData & setValue(int attributeIndex, double v)
virtual void getValues(float values[], const int &n)
virtual bool operator==(const GeoTessData &d) const
virtual void getValues(short values[], const int &n)
virtual void getValues(double values[], const int &n)
virtual GeoTessData & setValue(int attributeIndex, float v)
virtual int getInt(int attributeIndex) const
virtual void getValue(int attributeIndex, LONG_INT &val) const
virtual void getValues(int values[], const int &n)
virtual float getFloat(int attributeIndex) const
virtual void getValue(int attributeIndex, short &val) const
virtual byte getByte(int attributeIndex) const
virtual void getValue(int attributeIndex, double &val) const
virtual GeoTessData & setValue(int attributeIndex, byte v)
virtual bool isNaN(int attributeIndex) const
virtual void getValue(int attributeIndex, float &val) const
virtual void getValues(byte values[], const int &n)
virtual short getShort(int attributeIndex) const
virtual GeoTessData & setValue(int attributeIndex, int v)
virtual LONG_INT getLong(int attributeIndex) const
virtual GeoTessData & setValue(int attributeIndex, LONG_INT v)
virtual void getValues(LONG_INT values[], const int &n)
virtual void getValue(int attributeIndex, byte &val) const
virtual const GeoTessDataType & getDataType() const
virtual GeoTessData & setValue(int attributeIndex, short v)
virtual double getDouble(int attributeIndex) const
Opens a file for binary read and write access.