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)))); }
182 {
return attributeIndex == 0 ? (double) value : NaN_DOUBLE; }
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; };
194 {
return attributeIndex == 0 ? (short) value : SHRT_MIN; };
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; };
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; };
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
virtual bool operator==(const GeoTessData &d) const
Definition: GeoTessDataValue.h:176
virtual void getValues(LONG_INT values[], const int &n)
Definition: GeoTessDataValue.h:249
virtual byte getByte(int attributeIndex) const
Definition: GeoTessDataValue.h:196
virtual LONG_INT getLong(int attributeIndex) const
Definition: GeoTessDataValue.h:187
virtual void getValue(int attributeIndex, float &val) const
Definition: GeoTessDataValue.h:209
virtual void getValue(int attributeIndex, LONG_INT &val) const
Definition: GeoTessDataValue.h:215
Opens a file for binary read and write access.
Definition: IFStreamBinary.h:79
virtual void getValues(short values[], const int &n)
Definition: GeoTessDataValue.h:259
virtual GeoTessData & setValue(int attributeIndex, double v)
Definition: GeoTessDataValue.h:269
virtual void getValue(int attributeIndex, double &val) const
Definition: GeoTessDataValue.h:203
virtual GeoTessData & setValue(int attributeIndex, int v)
Definition: GeoTessDataValue.h:278
void readType(string &s)
Definition: IFStreamBinary.h:764
Enumeration of supported DataType including DOUBLE, FLOAT, LONG, INT, SHORT and BYTE.
Definition: GeoTessDataType.h:67
virtual short getShort(int attributeIndex) const
Definition: GeoTessDataValue.h:193
Manages a single data value attached to a grid node.
Definition: GeoTessData.h:63
virtual GeoTessData & setValue(int attributeIndex, float v)
Definition: GeoTessDataValue.h:272
virtual void getValue(int attributeIndex, byte &val) const
Definition: GeoTessDataValue.h:233
virtual void getValue(int attributeIndex, short &val) const
Definition: GeoTessDataValue.h:227
virtual void getValues(byte values[], const int &n)
Definition: GeoTessDataValue.h:264
virtual const GeoTessDataType & getDataType() const
Definition: GeoTessDataValue.h:158
#define byte
signed-byte typedef
Definition: CPPGlobals.h:94
virtual GeoTessData & setValue(int attributeIndex, LONG_INT v)
Definition: GeoTessDataValue.h:275
virtual void getValue(int attributeIndex, int &val) const
Definition: GeoTessDataValue.h:221
virtual int size() const
Definition: GeoTessDataValue.h:163
GeoTessDataValue(T v)
Definition: GeoTessDataValue.h:88
#define LONG_INT
Definition: CPPGlobals.h:111
Abstract base class that manages the data values attached to a single grid point. ...
Definition: GeoTessData.h:75
virtual void getValues(int values[], const int &n)
Definition: GeoTessDataValue.h:254
virtual double getDouble(int attributeIndex) const
Definition: GeoTessDataValue.h:181
virtual GeoTessData & setValue(int attributeIndex, short v)
Definition: GeoTessDataValue.h:281
GeoTessDataValue()
Definition: GeoTessDataValue.h:93
virtual void getValues(double values[], const int &n)
Definition: GeoTessDataValue.h:239
#define GEOTESS_EXP_IMP
Definition: CPPGlobals.h:71
virtual int getInt(int attributeIndex) const
Definition: GeoTessDataValue.h:190
virtual bool isNaN(int attributeIndex) const
Definition: GeoTessDataValue.h:298
virtual GeoTessData * copy()
Definition: GeoTessDataValue.h:303
virtual void getValues(float values[], const int &n)
Definition: GeoTessDataValue.h:244
virtual GeoTessData & setValue(int attributeIndex, byte v)
Definition: GeoTessDataValue.h:284
virtual float getFloat(int attributeIndex) const
Definition: GeoTessDataValue.h:184