GeoTessCPP  2.0.0
Software to facilitate storage and retrieval of 3D information about the Earth.
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines
include/GeoTessDataType.h
Go to the documentation of this file.
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 DATATYPE_OBJECT_H
00037 #define DATATYPE_OBJECT_H
00038 
00039 // **** _SYSTEM INCLUDES_ ******************************************************
00040 
00041 #include <iostream>
00042 #include <string>
00043 
00044 // use standard library objects
00045 using namespace std;
00046 
00047 // **** _LOCAL INCLUDES_ *******************************************************
00048 
00049 #include "GeoTessEnumType.h"
00050 
00051 // **** _BEGIN GEOTESS NAMESPACE_ **********************************************
00052 
00053 namespace geotess
00054 {
00055 
00056 // **** _FORWARD REFERENCES_ ***************************************************
00057 
00058 // **** _CLASS DEFINITION_ *****************************************************
00059 
00067 class GEOTESS_EXP_IMP GeoTessDataType: public GeoTessEnumType
00068 {
00069 private:
00070 
00074         GeoTessDataType() : GeoTessEnumType()
00075         {
00076         }
00077 
00081         GeoTessDataType(const GeoTessDataType& dt) : GeoTessEnumType(dt)
00082         {
00083         }
00084 
00088         GeoTessDataType& operator=(const GeoTessDataType& dt)
00089         {
00090                 return *this;
00091         }
00092 
00096         static const int aSize;
00097 
00102         static inline int nextOrdinal()
00103         {
00104                 static int firstOrdinal = 0;
00105                 return firstOrdinal++;
00106         }
00107 
00113         GeoTessDataType(const string& name)
00114                         : GeoTessEnumType(name, nextOrdinal())
00115         {
00116         }
00117 
00118 public:
00119 
00123         static const GeoTessDataType DOUBLE;
00124         static const GeoTessDataType FLOAT;
00125         static const GeoTessDataType LONG;
00126         static const GeoTessDataType INT;
00127         static const GeoTessDataType SHORT;
00128         static const GeoTessDataType BYTE;
00129         static const GeoTessDataType NONE;
00130 
00134         static const GeoTessDataType* aArray[];
00135 
00139         virtual ~GeoTessDataType()
00140         {
00141         }
00142 
00143 //              /**
00144 //               * Assignment Operator.
00145 //               */
00146 //              DataType& DataType::operator=(const DataType& dt)
00147 //              {
00148 //                      EnumType::operator=(dt);
00149 //
00150 //                      return *this;
00151 //              }
00152 
00160         static const GeoTessDataType* valueOf(const string& s)
00161         {
00162                 return (const GeoTessDataType*) GeoTessEnumType::valueOf(s,
00163                                 (GeoTessEnumType const* const * const ) aArray, aSize);
00164         }
00165 
00169         static GeoTessDataType const* const * const values()
00170         {
00171                 return aArray;
00172         }
00173 
00177         static int size()
00178         {
00179                 return aSize;
00180         }
00181 
00182         /*
00183          * Return DataType.
00184          */
00185         template<typename T>
00186         static const GeoTessDataType& getDataType(T typ)
00187         {
00188                 return GeoTessDataType::NONE;
00189         }
00190 
00191 };
00192 // end class DataType
00193 
00197 template<>
00198 inline const GeoTessDataType& GeoTessDataType::getDataType<double>(double typ)
00199 {
00200         return GeoTessDataType::DOUBLE;
00201 }
00202 
00206 template<>
00207 inline const GeoTessDataType& GeoTessDataType::getDataType<float>(float typ)
00208 {
00209         return GeoTessDataType::FLOAT;
00210 }
00211 
00215 template<>
00216 inline const GeoTessDataType& GeoTessDataType::getDataType<LONG_INT>(LONG_INT typ)
00217 {
00218         return GeoTessDataType::LONG;
00219 }
00220 
00224 template<>
00225 inline const GeoTessDataType& GeoTessDataType::getDataType<int>(int typ)
00226 {
00227         return GeoTessDataType::INT;
00228 }
00229 
00233 template<>
00234 inline const GeoTessDataType& GeoTessDataType::getDataType<short>(short typ)
00235 {
00236         return GeoTessDataType::SHORT;
00237 }
00238 
00242 template<>
00243 inline const GeoTessDataType& GeoTessDataType::getDataType<byte>(byte typ)
00244 {
00245         return GeoTessDataType::BYTE;
00246 }
00247 
00248 } // end namespace geotess
00249 
00250 #endif  // DATATYPE_OBJECT_H