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; };
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; };
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; }
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 (isnan(value));
327 inline bool GeoTessDataValue<float>::isNaN(
int attributeIndex)
const
329 double v = (double) value;
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;
391 #endif // DATAVALUE_OBJECT_H
virtual bool operator==(const GeoTessData &d) const
Return true if the input DataValue object (d) equals this DataValue object. ...
Definition: GeoTessDataValue.h:178
virtual void getValues(LONG_INT values[], const int &n)
Copy value into the supplied array at index 0 as a LONG_INT value.
Definition: GeoTessDataValue.h:251
virtual byte getByte(int attributeIndex) const
Retrieve the value of the attribute at the specified attribute index as a bute value.
Definition: GeoTessDataValue.h:198
virtual LONG_INT getLong(int attributeIndex) const
Retrieve the value of the attribute at the specified attribute index as a LONG_INT value...
Definition: GeoTessDataValue.h:189
virtual void getValue(int attributeIndex, float &val) const
Returns the attribute at the input attribute index as a float value.
Definition: GeoTessDataValue.h:211
Definition: ArrayReuse.h:55
virtual void getValue(int attributeIndex, LONG_INT &val) const
Returns the attribute at the input attribute index as a long value.
Definition: GeoTessDataValue.h:217
Opens a file for binary read and write access.
Definition: IFStreamBinary.h:79
virtual void getValues(short values[], const int &n)
Copy value into the supplied array at index 0 as a short value.
Definition: GeoTessDataValue.h:261
virtual GeoTessData & setValue(int attributeIndex, double v)
Set the value at the input attribute index to the input intrinsic.
Definition: GeoTessDataValue.h:271
virtual void getValue(int attributeIndex, double &val) const
Returns the attribute at the input attribute index as a double value.
Definition: GeoTessDataValue.h:205
virtual GeoTessData & setValue(int attributeIndex, int v)
Set the value of the specified attributeIndex and return a reference to this Data object...
Definition: GeoTessDataValue.h:280
void readType(string &s)
Read in a string and assign it to 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
Retrieve the value of the attribute at the specified attribute index as a short value.
Definition: GeoTessDataValue.h:195
Manages a single data value attached to a grid node.
Definition: GeoTessData.h:63
virtual GeoTessData & setValue(int attributeIndex, float v)
Set the value of the specified attributeIndex and return a reference to this Data object...
Definition: GeoTessDataValue.h:274
virtual void getValue(int attributeIndex, byte &val) const
Returns the attribute at the input attribute index as a byte value.
Definition: GeoTessDataValue.h:235
virtual void getValue(int attributeIndex, short &val) const
Returns the attribute at the input attribute index as a short value.
Definition: GeoTessDataValue.h:229
virtual void getValues(byte values[], const int &n)
Copy value into the supplied array at index 0 as a byte value.
Definition: GeoTessDataValue.h:266
virtual const GeoTessDataType & getDataType() const
Retrieve the DataType of this Data object.
Definition: GeoTessDataValue.h:160
#define byte
signed-byte typedef
Definition: CPPGlobals.h:94
virtual GeoTessData & setValue(int attributeIndex, LONG_INT v)
Set the value of the specified attributeIndex and return a reference to this Data object...
Definition: GeoTessDataValue.h:277
virtual void getValue(int attributeIndex, int &val) const
Returns the attribute at the input attribute index as a int value.
Definition: GeoTessDataValue.h:223
virtual int size() const
Return size.
Definition: GeoTessDataValue.h:165
GeoTessDataValue(T v)
Standard constructor.
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)
Copy value into the supplied array at index 0 as an int value.
Definition: GeoTessDataValue.h:256
virtual double getDouble(int attributeIndex) const
Returns value as one of six intrinsic types.
Definition: GeoTessDataValue.h:183
virtual GeoTessData & setValue(int attributeIndex, short v)
Set the value of the specified attributeIndex and return a reference to this Data object...
Definition: GeoTessDataValue.h:283
GeoTessDataValue()
Default constructor.
Definition: GeoTessDataValue.h:93
virtual void getValues(double values[], const int &n)
Copy value into the supplied array at index 0 as a double value.
Definition: GeoTessDataValue.h:241
#define GEOTESS_EXP_IMP
Definition: CPPGlobals.h:71
virtual int getInt(int attributeIndex) const
Retrieve the value of the attribute at the specified attribute index as a int value.
Definition: GeoTessDataValue.h:192
virtual bool isNaN(int attributeIndex) const
Returns true if the specified attribute is NaN.
Definition: GeoTessDataValue.h:300
virtual GeoTessData * copy()
Returns a copy of this DataValue.
Definition: GeoTessDataValue.h:305
virtual void getValues(float values[], const int &n)
Copy value into the supplied array at index 0 as a float value.
Definition: GeoTessDataValue.h:246
virtual GeoTessData & setValue(int attributeIndex, byte v)
Set the value of the specified attributeIndex and return a reference to this Data object...
Definition: GeoTessDataValue.h:286
virtual float getFloat(int attributeIndex) const
Retrieve the value of the attribute at the specified attribute index as a float value.
Definition: GeoTessDataValue.h:186