GeoTessCPP: rstt/GeoTessCPP/include/GeoTessData.h Source File

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

GeoTessData.h
Go to the documentation of this file.
1 //- ****************************************************************************
2 //-
3 //- Copyright 2009 National Technology & Engineering Solutions of Sandia, LLC
4 //- (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
5 //- Government 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 //- 1. Redistributions of source code must retain the above copyright notice,
14 //- this list of conditions and the following disclaimer.
15 //-
16 //- 2. Redistributions in binary form must reproduce the above copyright
17 //- notice, this list of conditions and the following disclaimer in the
18 //- documentation and/or other materials provided with the distribution.
19 //-
20 //- 3. Neither the name of the copyright holder nor the names of its
21 //- contributors may be used to endorse or promote products derived from
22 //- this software without specific prior written permission.
23 //-
24 //- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 //- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 //- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 //- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
28 //- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 //- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 //- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 //- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 //- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 //- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 //- POSSIBILITY OF SUCH DAMAGE.
35 //-
36 //- ****************************************************************************
37
38 #ifndef GEO_DATA_OBJECT_H
39 #define GEO_DATA_OBJECT_H
40
41 // **** _SYSTEM INCLUDES_ ******************************************************
42
43 #include <iostream>
44 #include <string>
45 #include <fstream>
46
47 // use standard library objects
48 using namespace std;
49
50 // **** _LOCAL INCLUDES_ *******************************************************
51
52 #include "CPPGlobals.h"
53 #include "GeoTessDataType.h"
54
55 // **** _BEGIN GEOTESS NAMESPACE_ **********************************************
56
57 namespace geotess {
58
59 // **** _FORWARD REFERENCES_ ***************************************************
60
61 class GeoTessMetaData;
62 class IFStreamAscii;
63 class IFStreamBinary;
64 template<typename T> class GeoTessDataArray;
65 template<typename T> class GeoTessDataValue;
66
67 // **** _CLASS DEFINITION_ *****************************************************
68
77 class GEOTESS_EXP_IMP GeoTessData
78 {
79 private:
80
84 static int aClassCount;
85
86 public:
87
91 static string class_name() { return "Data"; };
92
96 virtual int class_size() const { return (int) sizeof(GeoTessData); };
97
101 static int class_count() { return aClassCount; };
102
103 virtual LONG_INT getMemory() = ABSTRACT;
104
109 virtual bool operator == (const GeoTessData& d) const
110 { return (getDataType() == d.getDataType()); }
111
120 static GeoTessData* getData(const GeoTessDataType& dataType, int nAttributes);
121
131 static GeoTessData* getData(double values[], const int& size);
132 static GeoTessData* getData(const vector<double>& values);
133
143 static GeoTessData* getData(float values[], const int& size);
144 static GeoTessData* getData(const vector<float>& values);
145
155 static GeoTessData* getData(LONG_INT values[], const int& size);
156 static GeoTessData* getData(const vector<LONG_INT>& values);
157
167 static GeoTessData* getData(int values[], const int& size);
168 static GeoTessData* getData(const vector<int>& values);
169
179 static GeoTessData* getData(short values[], const int& size);
180 static GeoTessData* getData(const vector<short>& values);
181
191 static GeoTessData* getData(byte values[], const int& size);
192 static GeoTessData* getData(const vector<byte>& values);
193
199 virtual const GeoTessDataType& getDataType() const = ABSTRACT;
200
205 virtual int size() const = ABSTRACT;
206
212 virtual double getDouble(int attributeIndex) const = ABSTRACT;
213
219 virtual float getFloat(int attributeIndex) const = ABSTRACT;
220
226 virtual LONG_INT getLong(int attributeIndex) const = ABSTRACT;
227
233 virtual int getInt(int attributeIndex) const = ABSTRACT;
234
240 virtual short getShort(int attributeIndex) const = ABSTRACT;
241
247 virtual byte getByte(int attributeIndex) const = ABSTRACT;
248
252 virtual void getValue(int attributeIndex, double& val) const = ABSTRACT;
253
257 virtual void getValue(int attributeIndex, float& val) const = ABSTRACT;
258
262 virtual void getValue(int attributeIndex, LONG_INT& val) const = ABSTRACT;
263
267 virtual void getValue(int attributeIndex, int& val) const = ABSTRACT;
268
272 virtual void getValue(int attributeIndex, short& val) const = ABSTRACT;
273
277 virtual void getValue(int attributeIndex, byte& val) const = ABSTRACT;
278
284 virtual void getValues(double values[], const int& n) = ABSTRACT;
285
291 virtual void getValues(float values[], const int& n) = ABSTRACT;
292
298 virtual void getValues(LONG_INT values[], const int& n) = ABSTRACT;
299
305 virtual void getValues(int values[], const int& n) = ABSTRACT;
306
312 virtual void getValues(short values[], const int& n) = ABSTRACT;
313
319 virtual void getValues(byte values[], const int& n) = ABSTRACT;
320
321
329 virtual GeoTessData& setValue(int attributeIndex, double v) = ABSTRACT;
330
338 virtual GeoTessData& setValue(int attributeIndex, float v) = ABSTRACT;
339
347 virtual GeoTessData& setValue(int attributeIndex, LONG_INT v) = ABSTRACT;
348
356 virtual GeoTessData& setValue(int attributeIndex, int v) = ABSTRACT;
357
365 virtual GeoTessData& setValue(int attributeIndex, short v) = ABSTRACT;
366
374 virtual GeoTessData& setValue(int attributeIndex, byte v) = ABSTRACT;
375
376
383 template <typename T>
384 void fill(T fillValue) { for (int i=0; i<size(); ++i) setValue(i,fillValue);}
385
397 virtual bool isNaN(int attributeIndex) const = ABSTRACT;
398
399
401
405 GeoTessData() { ++aClassCount; };
406
410 virtual ~GeoTessData();
411
416 virtual GeoTessData* copy() = ABSTRACT;
417
423 static GeoTessData* getData(IFStreamBinary& ifs, GeoTessMetaData& gtmd);
424
430 static GeoTessData* getData(IFStreamAscii& input, GeoTessMetaData& gtmd);
431
436 virtual void write(IFStreamBinary& ofs) = ABSTRACT;
437
442 virtual void write(IFStreamAscii& ofs) = ABSTRACT;
443
445
446 }; // end class Data
447
448 } // end namespace geotess
449
450 #endif // DATA_OBJECT_H
geotess::GeoTessData::setValue
virtual GeoTessData & setValue(int attributeIndex, short v)
geotess::GeoTessData::getData
static GeoTessData * getData(const vector< float > &values)
geotess::GeoTessData::getData
static GeoTessData * getData(const GeoTessDataType &dataType, int nAttributes)
geotess
Definition: ArrayReuse.h:57
geotess::GeoTessData::getMemory
virtual LONG_INT getMemory()
geotess::GeoTessData::getData
static GeoTessData * getData(const vector< LONG_INT > &values)
geotess::GeoTessData::getValue
virtual void getValue(int attributeIndex, LONG_INT &val) const
geotess::GeoTessDataValue
Manages a single data value attached to a grid node.
Definition: GeoTessData.h:65
geotess::GeoTessData::getInt
virtual int getInt(int attributeIndex) const
geotess::GeoTessData::getValues
virtual void getValues(short values[], const int &n)
geotess::GeoTessData::getData
static GeoTessData * getData(const vector< byte > &values)
geotess::GeoTessData::getValue
virtual void getValue(int attributeIndex, double &val) const
geotess::GeoTessData::getData
static GeoTessData * getData(byte values[], const int &size)
geotess::GeoTessData::getValues
virtual void getValues(float values[], const int &n)
geotess::GeoTessData::getValues
virtual void getValues(LONG_INT values[], const int &n)
geotess::GeoTessData::getValue
virtual void getValue(int attributeIndex, float &val) const
geotess::GeoTessData::size
virtual int size() const
geotess::GeoTessData::class_count
static int class_count()
Definition: GeoTessData.h:101
geotess::GeoTessData::getData
static GeoTessData * getData(float values[], const int &size)
geotess::GeoTessData::getValue
virtual void getValue(int attributeIndex, short &val) const
geotess::GeoTessData::getValue
virtual void getValue(int attributeIndex, int &val) const
geotess::GeoTessData::getLong
virtual LONG_INT getLong(int attributeIndex) const
geotess::IFStreamAscii
Opens ascii file for read and write access.
Definition: IFStreamAscii.h:83
geotess::GeoTessDataType
Enumeration of supported DataType including DOUBLE, FLOAT, LONG, INT, SHORT and BYTE.
Definition: GeoTessDataType.h:70
LONG_INT
#define LONG_INT
Definition: CPPGlobals.h:113
geotess::GeoTessData::setValue
virtual GeoTessData & setValue(int attributeIndex, int v)
geotess::GeoTessData::getData
static GeoTessData * getData(short values[], const int &size)
geotess::GeoTessData::getData
static GeoTessData * getData(double values[], const int &size)
geotess::GeoTessData::getData
static GeoTessData * getData(const vector< int > &values)
geotess::GeoTessData::getFloat
virtual float getFloat(int attributeIndex) const
geotess::GeoTessData::getValues
virtual void getValues(int values[], const int &n)
geotess::GeoTessData::class_name
static string class_name()
Definition: GeoTessData.h:91
geotess::GeoTessData
Abstract base class that manages the data values attached to a single grid point.
Definition: GeoTessData.h:78
geotess::GeoTessData::setValue
virtual GeoTessData & setValue(int attributeIndex, float v)
GEOTESS_EXP_IMP
#define GEOTESS_EXP_IMP
Definition: CPPGlobals.h:73
geotess::GeoTessData::getData
static GeoTessData * getData(LONG_INT values[], const int &size)
geotess::GeoTessData::getData
static GeoTessData * getData(const vector< double > &values)
geotess::GeoTessData::getDataType
virtual const GeoTessDataType & getDataType() const
geotess::IFStreamBinary
Opens a file for binary read and write access.
Definition: IFStreamBinary.h:82
geotess::GeoTessData::getDouble
virtual double getDouble(int attributeIndex) const
geotess::GeoTessMetaData
Basic metadata information about a GeoTessModel.
Definition: GeoTessMetaData.h:98
geotess::GeoTessData::getData
static GeoTessData * getData(int values[], const int &size)
ABSTRACT
#define ABSTRACT
Global constant used to make pure virtual functions readable.
Definition: CPPGlobals.h:80
geotess::GeoTessData::fill
void fill(T fillValue)
Definition: GeoTessData.h:384
geotess::GeoTessData::class_size
virtual int class_size() const
Definition: GeoTessData.h:96
geotess::GeoTessData::getByte
virtual byte getByte(int attributeIndex) const
geotess::GeoTessData::setValue
virtual GeoTessData & setValue(int attributeIndex, double v)
GeoTessDataType.h
CPPGlobals.h
geotess::GeoTessData::getShort
virtual short getShort(int attributeIndex) const
geotess::GeoTessData::getData
static GeoTessData * getData(const vector< short > &values)
geotess::GeoTessData::setValue
virtual GeoTessData & setValue(int attributeIndex, byte v)
geotess::GeoTessDataArray
Manages a 1D array of data values attached to a single grid node.
Definition: GeoTessData.h:64
geotess::GeoTessData::getValue
virtual void getValue(int attributeIndex, byte &val) const
geotess::GeoTessData::setValue
virtual GeoTessData & setValue(int attributeIndex, LONG_INT v)
geotess::GeoTessData::getValues
virtual void getValues(byte values[], const int &n)
geotess::GeoTessData::getValues
virtual void getValues(double values[], const int &n)
geotess::GeoTessData::isNaN
virtual bool isNaN(int attributeIndex) const