GeoTessCPP
2.0.0
Software to facilitate storage and retrieval of 3D information about the Earth.
|
00001 //- **************************************************************************** 00002 //- 00003 //- Copyright 2009 Sandia Corporation. Under the terms of Contract 00004 //- DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 00005 //- retains certain rights in this software. 00006 //- 00007 //- BSD Open Source License. 00008 //- All rights reserved. 00009 //- 00010 //- Redistribution and use in source and binary forms, with or without 00011 //- modification, are permitted provided that the following conditions are met: 00012 //- 00013 //- * Redistributions of source code must retain the above copyright notice, 00014 //- this list of conditions and the following disclaimer. 00015 //- * Redistributions in binary form must reproduce the above copyright 00016 //- notice, this list of conditions and the following disclaimer in the 00017 //- documentation and/or other materials provided with the distribution. 00018 //- * Neither the name of Sandia National Laboratories nor the names of its 00019 //- contributors may be used to endorse or promote products derived from 00020 //- this software without specific prior written permission. 00021 //- 00022 //- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00023 //- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00024 //- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00025 //- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00026 //- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00027 //- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00028 //- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00029 //- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00030 //- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00031 //- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 //- POSSIBILITY OF SUCH DAMAGE. 00033 //- 00034 //- **************************************************************************** 00035 00036 #ifndef GEO_DATA_OBJECT_H 00037 #define GEO_DATA_OBJECT_H 00038 00039 // **** _SYSTEM INCLUDES_ ****************************************************** 00040 00041 #include <iostream> 00042 #include <string> 00043 #include <fstream> 00044 00045 // use standard library objects 00046 using namespace std; 00047 00048 // **** _LOCAL INCLUDES_ ******************************************************* 00049 00050 #include "CPPGlobals.h" 00051 #include "GeoTessDataType.h" 00052 00053 // **** _BEGIN GEOTESS NAMESPACE_ ********************************************** 00054 00055 namespace geotess { 00056 00057 // **** _FORWARD REFERENCES_ *************************************************** 00058 00059 class GeoTessMetaData; 00060 class IFStreamAscii; 00061 class IFStreamBinary; 00062 template<typename T> class GeoTessDataArray; 00063 template<typename T> class GeoTessDataValue; 00064 00065 // **** _CLASS DEFINITION_ ***************************************************** 00066 00075 class GEOTESS_EXP_IMP GeoTessData 00076 { 00077 private: 00078 00082 static int aClassCount; 00083 00084 public: 00085 00089 static string class_name() { return "Data"; }; 00090 00094 virtual int class_size() const { return (int) sizeof(GeoTessData); }; 00095 00099 static int class_count() { return aClassCount; }; 00100 00105 virtual bool operator == (const GeoTessData& d) const 00106 { return (getDataType() == d.getDataType()); } 00107 00117 static GeoTessData* getData(double values[], const int& size); 00118 static GeoTessData* getData(const vector<double>& values); 00119 00129 static GeoTessData* getData(float values[], const int& size); 00130 static GeoTessData* getData(const vector<float>& values); 00131 00141 static GeoTessData* getData(LONG_INT values[], const int& size); 00142 static GeoTessData* getData(const vector<LONG_INT>& values); 00143 00153 static GeoTessData* getData(int values[], const int& size); 00154 static GeoTessData* getData(const vector<int>& values); 00155 00165 static GeoTessData* getData(short values[], const int& size); 00166 static GeoTessData* getData(const vector<short>& values); 00167 00177 static GeoTessData* getData(byte values[], const int& size); 00178 static GeoTessData* getData(const vector<byte>& values); 00179 00185 virtual const GeoTessDataType& getDataType() const = ABSTRACT; 00186 00191 virtual int size() const = ABSTRACT; 00192 00198 virtual double getDouble(int attributeIndex) const = ABSTRACT; 00199 00205 virtual float getFloat(int attributeIndex) const = ABSTRACT; 00206 00212 virtual LONG_INT getLong(int attributeIndex) const = ABSTRACT; 00213 00219 virtual int getInt(int attributeIndex) const = ABSTRACT; 00220 00226 virtual short getShort(int attributeIndex) const = ABSTRACT; 00227 00233 virtual byte getByte(int attributeIndex) const = ABSTRACT; 00234 00238 virtual void getValue(int attributeIndex, double& val) const = ABSTRACT; 00239 00243 virtual void getValue(int attributeIndex, float& val) const = ABSTRACT; 00244 00248 virtual void getValue(int attributeIndex, LONG_INT& val) const = ABSTRACT; 00249 00253 virtual void getValue(int attributeIndex, int& val) const = ABSTRACT; 00254 00258 virtual void getValue(int attributeIndex, short& val) const = ABSTRACT; 00259 00263 virtual void getValue(int attributeIndex, byte& val) const = ABSTRACT; 00264 00270 virtual void getValues(double values[], const int& n) = ABSTRACT; 00271 00277 virtual void getValues(float values[], const int& n) = ABSTRACT; 00278 00284 virtual void getValues(LONG_INT values[], const int& n) = ABSTRACT; 00285 00291 virtual void getValues(int values[], const int& n) = ABSTRACT; 00292 00298 virtual void getValues(short values[], const int& n) = ABSTRACT; 00299 00305 virtual void getValues(byte values[], const int& n) = ABSTRACT; 00306 00307 00315 virtual GeoTessData& setValue(int attributeIndex, double v) = ABSTRACT; 00316 00324 virtual GeoTessData& setValue(int attributeIndex, float v) = ABSTRACT; 00325 00333 virtual GeoTessData& setValue(int attributeIndex, LONG_INT v) = ABSTRACT; 00334 00342 virtual GeoTessData& setValue(int attributeIndex, int v) = ABSTRACT; 00343 00351 virtual GeoTessData& setValue(int attributeIndex, short v) = ABSTRACT; 00352 00360 virtual GeoTessData& setValue(int attributeIndex, byte v) = ABSTRACT; 00361 00362 00369 template <typename T> 00370 void fill(T fillValue) { for (int i=0; i<size(); ++i) setValue(i,fillValue);} 00371 00383 virtual bool isNaN(int attributeIndex) const = ABSTRACT; 00384 00385 00387 00391 GeoTessData() { ++aClassCount; }; 00392 00396 virtual ~GeoTessData(); 00397 00402 virtual GeoTessData* copy() = ABSTRACT; 00403 00409 static GeoTessData* getData(IFStreamBinary& ifs, GeoTessMetaData& gtmd); 00410 00416 static GeoTessData* getData(IFStreamAscii& input, GeoTessMetaData& gtmd); 00417 00422 virtual void write(IFStreamBinary& ofs) = ABSTRACT; 00423 00428 virtual void write(IFStreamAscii& ofs) = ABSTRACT; 00429 00431 00432 }; // end class Data 00433 00434 } // end namespace geotess 00435 00436 #endif // DATA_OBJECT_H