GeoTessCPP 2.6.1 Software to facilitate storage and retrieval of 3D information about the Earth.

Loading...
Searching...
No Matches
GeoTessData.h
Go to the documentation of this file.
1//- ****************************************************************************
2//-
3//- Copyright 2009 Sandia Corporation. Under the terms of Contract
4//- DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
5//- retains certain rights in this software.
6//-
7//- BSD Open Source License.
8//- All rights reserved.
9//-
10//- Redistribution and use in source and binary forms, with or without
11//- modification, are permitted provided that the following conditions are met:
12//-
13//- * Redistributions of source code must retain the above copyright notice,
14//- this list of conditions and the following disclaimer.
15//- * Redistributions in binary form must reproduce the above copyright
16//- notice, this list of conditions and the following disclaimer in the
17//- documentation and/or other materials provided with the distribution.
18//- * Neither the name of Sandia National Laboratories nor the names of its
19//- contributors may be used to endorse or promote products derived from
20//- this software without specific prior written permission.
21//-
22//- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23//- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24//- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25//- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26//- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27//- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28//- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29//- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30//- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31//- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32//- POSSIBILITY OF SUCH DAMAGE.
33//-
34//- ****************************************************************************
35
36#ifndef GEO_DATA_OBJECT_H
37#define GEO_DATA_OBJECT_H
38
39// **** _SYSTEM INCLUDES_ ******************************************************
40
41#include <iostream>
42#include <string>
43#include <fstream>
44
45// use standard library objects
46 using namespace std;
47
48// **** _LOCAL INCLUDES_ *******************************************************
49
50#include "CPPGlobals.h"
51#include "GeoTessDataType.h"
52
53// **** _BEGIN GEOTESS NAMESPACE_ **********************************************
54
55 namespace geotess {
56
57// **** _FORWARD REFERENCES_ ***************************************************
58
59 class GeoTessMetaData;
60 class IFStreamAscii;
61 class IFStreamBinary;
62 template<typename T> class GeoTessDataArray;
63 template<typename T> class GeoTessDataValue;
64
65// **** _CLASS DEFINITION_ *****************************************************
66
75 class GEOTESS_EXP_IMP GeoTessData
76{
77 private:
78
82 static int aClassCount;
83
84 public:
85
89 static string class_name() { return "Data"; };
90
94 virtual int class_size() const { return (int) sizeof(GeoTessData); };
95
99 static int class_count() { return aClassCount; };
100
101 virtual LONG_INT getMemory() = ABSTRACT;
102
107 virtual bool operator == (const GeoTessData& d) const
108 { return (getDataType() == d.getDataType()); }
109
118 static GeoTessData* getData(const GeoTessDataType& dataType, int nAttributes);
119
129 static GeoTessData* getData(double values[], const int& size);
130 static GeoTessData* getData(const vector<double>& values);
131
141 static GeoTessData* getData(float values[], const int& size);
142 static GeoTessData* getData(const vector<float>& values);
143
153 static GeoTessData* getData(LONG_INT values[], const int& size);
154 static GeoTessData* getData(const vector<LONG_INT>& values);
155
165 static GeoTessData* getData(int values[], const int& size);
166 static GeoTessData* getData(const vector<int>& values);
167
177 static GeoTessData* getData(short values[], const int& size);
178 static GeoTessData* getData(const vector<short>& values);
179
189 static GeoTessData* getData(byte values[], const int& size);
190 static GeoTessData* getData(const vector<byte>& values);
191
197 virtual const GeoTessDataType& getDataType() const = ABSTRACT;
198
203 virtual int size() const = ABSTRACT;
204
210 virtual double getDouble(int attributeIndex) const = ABSTRACT;
211
217 virtual float getFloat(int attributeIndex) const = ABSTRACT;
218
224 virtual LONG_INT getLong(int attributeIndex) const = ABSTRACT;
225
231 virtual int getInt(int attributeIndex) const = ABSTRACT;
232
238 virtual short getShort(int attributeIndex) const = ABSTRACT;
239
245 virtual byte getByte(int attributeIndex) const = ABSTRACT;
246
250 virtual void getValue(int attributeIndex, double& val) const = ABSTRACT;
251
255 virtual void getValue(int attributeIndex, float& val) const = ABSTRACT;
256
260 virtual void getValue(int attributeIndex, LONG_INT& val) const = ABSTRACT;
261
265 virtual void getValue(int attributeIndex, int& val) const = ABSTRACT;
266
270 virtual void getValue(int attributeIndex, short& val) const = ABSTRACT;
271
275 virtual void getValue(int attributeIndex, byte& val) const = ABSTRACT;
276
282 virtual void getValues(double values[], const int& n) = ABSTRACT;
283
289 virtual void getValues(float values[], const int& n) = ABSTRACT;
290
296 virtual void getValues(LONG_INT values[], const int& n) = ABSTRACT;
297
303 virtual void getValues(int values[], const int& n) = ABSTRACT;
304
310 virtual void getValues(short values[], const int& n) = ABSTRACT;
311
317 virtual void getValues(byte values[], const int& n) = ABSTRACT;
318
319
327 virtual GeoTessData& setValue(int attributeIndex, double v) = ABSTRACT;
328
336 virtual GeoTessData& setValue(int attributeIndex, float v) = ABSTRACT;
337
345 virtual GeoTessData& setValue(int attributeIndex, LONG_INT v) = ABSTRACT;
346
354 virtual GeoTessData& setValue(int attributeIndex, int v) = ABSTRACT;
355
363 virtual GeoTessData& setValue(int attributeIndex, short v) = ABSTRACT;
364
372 virtual GeoTessData& setValue(int attributeIndex, byte v) = ABSTRACT;
373
374
381 template <typename T>
382 void fill(T fillValue) { for (int i=0; i<size(); ++i) setValue(i,fillValue);}
383
395 virtual bool isNaN(int attributeIndex) const = ABSTRACT;
396
397
399
403 GeoTessData() { ++aClassCount; };
404
408 virtual ~GeoTessData();
409
414 virtual GeoTessData* copy() = ABSTRACT;
415
421 static GeoTessData* getData(IFStreamBinary& ifs, GeoTessMetaData& gtmd);
422
428 static GeoTessData* getData(IFStreamAscii& input, GeoTessMetaData& gtmd);
429
434 virtual void write(IFStreamBinary& ofs) = ABSTRACT;
435
440 virtual void write(IFStreamAscii& ofs) = ABSTRACT;
441
443
444}; // end class Data
445
446} // end namespace geotess
447
448#endif // DATA_OBJECT_H
CPPGlobals.h
GEOTESS_EXP_IMP
#define GEOTESS_EXP_IMP
Definition CPPGlobals.h:71
LONG_INT
#define LONG_INT
Definition CPPGlobals.h:111
ABSTRACT
#define ABSTRACT
Global constant used to make pure virtual functions readable.
Definition CPPGlobals.h:78
GeoTessDataType.h
geotess::GeoTessDataArray
Manages a 1D array of data values attached to a single grid node.
Definition GeoTessDataArray.h:73
geotess::GeoTessData
Abstract base class that manages the data values attached to a single grid point.
Definition GeoTessData.h:76
geotess::GeoTessData::getData
static GeoTessData * getData(short values[], const int &size)
geotess::GeoTessData::setValue
virtual GeoTessData & setValue(int attributeIndex, LONG_INT v)
geotess::GeoTessData::class_size
virtual int class_size() const
Definition GeoTessData.h:94
geotess::GeoTessData::getData
static GeoTessData * getData(const vector< double > &values)
geotess::GeoTessData::getMemory
virtual LONG_INT getMemory()
geotess::GeoTessData::getValue
virtual void getValue(int attributeIndex, byte &val) const
geotess::GeoTessData::getData
static GeoTessData * getData(const vector< byte > &values)
geotess::GeoTessData::getByte
virtual byte getByte(int attributeIndex) const
geotess::GeoTessData::getDataType
virtual const GeoTessDataType & getDataType() const
geotess::GeoTessData::size
virtual int size() const
geotess::GeoTessData::getValues
virtual void getValues(byte values[], const int &n)
geotess::GeoTessData::getFloat
virtual float getFloat(int attributeIndex) const
geotess::GeoTessData::getValues
virtual void getValues(short values[], const int &n)
geotess::GeoTessData::getData
static GeoTessData * getData(const vector< int > &values)
geotess::GeoTessData::getData
static GeoTessData * getData(byte values[], const int &size)
geotess::GeoTessData::fill
void fill(T fillValue)
Definition GeoTessData.h:382
geotess::GeoTessData::setValue
virtual GeoTessData & setValue(int attributeIndex, double v)
geotess::GeoTessData::setValue
virtual GeoTessData & setValue(int attributeIndex, float v)
geotess::GeoTessData::getDouble
virtual double getDouble(int attributeIndex) const
geotess::GeoTessData::getValue
virtual void getValue(int attributeIndex, LONG_INT &val) const
geotess::GeoTessData::getValue
virtual void getValue(int attributeIndex, int &val) const
geotess::GeoTessData::getData
static GeoTessData * getData(const vector< float > &values)
geotess::GeoTessData::setValue
virtual GeoTessData & setValue(int attributeIndex, byte v)
geotess::GeoTessData::class_name
static string class_name()
Definition GeoTessData.h:89
geotess::GeoTessData::getLong
virtual LONG_INT getLong(int attributeIndex) const
geotess::GeoTessData::getValues
virtual void getValues(float values[], const int &n)
geotess::GeoTessData::setValue
virtual GeoTessData & setValue(int attributeIndex, int v)
geotess::GeoTessData::getValue
virtual void getValue(int attributeIndex, short &val) const
geotess::GeoTessData::class_count
static int class_count()
Definition GeoTessData.h:99
geotess::GeoTessData::getValue
virtual void getValue(int attributeIndex, float &val) const
geotess::GeoTessData::getData
static GeoTessData * getData(LONG_INT values[], const int &size)
geotess::GeoTessData::getInt
virtual int getInt(int attributeIndex) const
geotess::GeoTessData::isNaN
virtual bool isNaN(int attributeIndex) const
geotess::GeoTessData::getData
static GeoTessData * getData(const GeoTessDataType &dataType, int nAttributes)
geotess::GeoTessData::getValues
virtual void getValues(double values[], const int &n)
geotess::GeoTessData::setValue
virtual GeoTessData & setValue(int attributeIndex, short v)
geotess::GeoTessData::getData
static GeoTessData * getData(const vector< LONG_INT > &values)
geotess::GeoTessData::getData
static GeoTessData * getData(const vector< short > &values)
geotess::GeoTessData::getData
static GeoTessData * getData(double values[], const int &size)
geotess::GeoTessData::getValues
virtual void getValues(LONG_INT values[], const int &n)
geotess::GeoTessData::getData
static GeoTessData * getData(float values[], const int &size)
geotess::GeoTessData::getData
static GeoTessData * getData(int values[], const int &size)
geotess::GeoTessData::getValue
virtual void getValue(int attributeIndex, double &val) const
geotess::GeoTessData::getValues
virtual void getValues(int values[], const int &n)
geotess::GeoTessData::getShort
virtual short getShort(int attributeIndex) const
geotess::GeoTessDataType
Enumeration of supported DataType including DOUBLE, FLOAT, LONG, INT, SHORT and BYTE.
Definition GeoTessDataType.h:68
geotess::GeoTessDataValue
Manages a single data value attached to a grid node.
Definition GeoTessDataValue.h:75
geotess::GeoTessMetaData
Basic metadata information about a GeoTessModel.
Definition GeoTessMetaData.h:97
geotess::IFStreamAscii
Opens ascii file for read and write access.
Definition IFStreamAscii.h:81
geotess::IFStreamBinary
Opens a file for binary read and write access.
Definition IFStreamBinary.h:80
geotess
Definition ArrayReuse.h:55