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/CPPGlobals.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 CPPGLOBALS_H_
00037 #define CPPGLOBALS_H_
00038 
00039 #include <cstdio>
00040 #include <cstdlib>
00041 #include <cassert>
00042 #include <limits>
00043 #include <cmath>
00044 #include <iostream>
00045 #include <vector>
00046 #include <map>
00047 #include <string>
00048 
00049 // Definition of dllimport and dllexport here for Windows only
00050 // Note that definitions are repeated for various tools/libraries.
00051 //--------------------------
00052 #if defined(_WIN32) || defined(WIN32)
00053 
00054   // exports when building GEOTESS dll, imports when linking to header files in
00055   // GEOTESS (Note that GEOTESS_EXPORTS should be defined when building a GEOTESS
00056   // DLL, and should  not be defined when linking with the GEOTESS DLL)
00057   #ifdef  GEOTESS_EXPORTS
00058   #define GEOTESS_EXP_IMP __declspec(dllexport)
00059   #else
00060   #define GEOTESS_EXP_IMP __declspec(dllimport)
00061   #endif
00062 
00063   // exports DLL for classes and functions that ONLY export
00064   // (Note that this is mainly used for templated classes that are not imported)
00065   #define GEOTESS_EXP     __declspec(dllexport)
00066 
00067   #define isnan(x) _isnan(x)
00068 
00069 #else  // Sun does not need these
00070 
00071   #define GEOTESS_EXP_IMP
00072   #define GEOTESS_EXP
00073 
00074 #endif
00075 
00076 #ifndef ABSTRACT
00077 
00078 #define ABSTRACT                            0
00079 #endif
00080 
00081 #ifndef int64
00082 
00083 typedef long long int64;
00084 #endif
00085 
00086 #ifndef uByte
00087 
00088 typedef unsigned char uByte;
00089 #endif
00090 
00091 #ifndef byte
00092 
00093 //typedef signed char byte;
00094 #define byte signed char
00095 #endif
00096 
00097 // Definition of LONG
00098 #if defined WIN32 || defined _WIN32
00099         #if defined _M_X64 || defined _M_AMD64
00100                 #define LONG_INT long
00101                 #define LONG_INT_F "%ld"
00102         #else
00103                 #define LONG_INT long long
00104                 #define LONG_INT_F "%lld"
00105         #endif
00106 #else
00107         #if defined __amd64__ || defined __amd64 || defined __x86_64__ || defined __x86_64
00108                 #define LONG_INT long
00109                 #define LONG_INT_F "%ld"
00110         #else
00111                 #define LONG_INT long long
00112                 #define LONG_INT_F "%lld"
00113         #endif
00114 #endif
00115 
00116 //These values are also defined in Util/BaseGlobals.h in the STR.
00117 //We won't define them again if it's already been included.
00118 #ifndef BaseGlobals_H
00119 
00123 static const double PI          = 3.1415926535897932384626;
00124 
00128 const double EARTH_RAD   = 6371.0;
00129 
00133 static const double EARTH_A = 6378.137;
00134 
00144 static const double EARTH_E = 0.006694379990141320;
00145 
00148 static const double RAD_TO_DEG  = 180./3.1415926535897932384626;
00149 //const double RAD_TO_DEG  = 57.295779513082320876798;
00150 
00154 static const double DEG_TO_RAD  = 3.1415926535897932384626/180.;
00155 //const double DEG_TO_RAD  = 0.017453292519943295769237;
00156 
00160 const double NA_VALUE    = -999999.0;
00161 
00162 #endif
00163 
00164 static const float                      NaN_FLOAT = std::numeric_limits<float>::quiet_NaN();
00165 static const double                     NaN_DOUBLE = std::numeric_limits<double>::quiet_NaN();
00166 
00167 #endif /* CPPGLOBALS_H_ */