GeoTessCPP  2.2
Software to facilitate storage and retrieval of 3D information about the Earth.
CPPGlobals.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 CPPGLOBALS_H_
37 #define CPPGLOBALS_H_
38 
39 #include <cstdio>
40 #include <cstdlib>
41 #include <cassert>
42 #include <limits>
43 #include <cmath>
44 #include <iostream>
45 #include <vector>
46 #include <map>
47 #include <string>
48 
49 // Definition of dllimport and dllexport here for Windows only
50 // Note that definitions are repeated for various tools/libraries.
51 //--------------------------
52 #if defined(_WIN32) || defined(WIN32)
53 
54  // exports when building GEOTESS dll, imports when linking to header files in
55  // GEOTESS (Note that GEOTESS_EXPORTS should be defined when building a GEOTESS
56  // DLL, and should not be defined when linking with the GEOTESS DLL)
57  #ifdef GEOTESS_EXPORTS
58  #define GEOTESS_EXP_IMP __declspec(dllexport)
59  #else
60  #define GEOTESS_EXP_IMP __declspec(dllimport)
61  #endif
62 
63  // exports DLL for classes and functions that ONLY export
64  // (Note that this is mainly used for templated classes that are not imported)
65  #define GEOTESS_EXP __declspec(dllexport)
66 
67  #define isnan(x) _isnan(x)
68 
69 #else // Sun does not need these
70 
71  #define GEOTESS_EXP_IMP
72  #define GEOTESS_EXP
73 
74 #endif
75 
76 #ifndef ABSTRACT
77 #define ABSTRACT 0
79 #endif
80 
81 #ifndef int64
82 typedef long long int64;
84 #endif
85 
86 #ifndef uByte
87 typedef unsigned char uByte;
89 #endif
90 
91 #ifndef byte
92 //typedef signed char byte;
94 #define byte signed char
95 #endif
96 
97 // Definition of LONG
98 #if defined WIN32 || defined _WIN32
99  #if defined _M_X64 || defined _M_AMD64
100  #define LONG_INT long
101  #define LONG_INT_F "%ld"
102  #else
103  #define LONG_INT long long
104  #define LONG_INT_F "%lld"
105  #endif
106 #else
107  #if defined __amd64__ || defined __amd64 || defined __x86_64__ || defined __x86_64
108  #define LONG_INT long
109  #define LONG_INT_F "%ld"
110  #else
111  #define LONG_INT long long
112  #define LONG_INT_F "%lld"
113  #endif
114 #endif
115 
116 //These values are also defined in Util/BaseGlobals.h in the STR.
117 //We won't define them again if it's already been included.
118 #ifndef BaseGlobals_H
119 
123 static const double PI = 3.1415926535897932384626;
124 
128 static const double PI_OVER_TWO = 0.5 * PI;
129 
133 const double EARTH_RAD = 6371.0;
134 
138 static const double EARTH_A = 6378.137;
139 
149 static const double EARTH_E = 0.006694379990141316; // 0.006694379990141320;
150 
153 static const double RAD_TO_DEG = 180./3.1415926535897932384626;
154 
158 static const double DEG_TO_RAD = 3.1415926535897932384626/180.;
159 
163 const double NA_VALUE = -999999.0;
164 
165 #endif
166 
167 static const float NaN_FLOAT = std::numeric_limits<float>::quiet_NaN();
168 static const double NaN_DOUBLE = std::numeric_limits<double>::quiet_NaN();
169 
170 #endif /* CPPGLOBALS_H_ */
const double NA_VALUE
Default constant for 'Not Available'.
Definition: CPPGlobals.h:163
const double EARTH_RAD
Earth average radius in km.
Definition: CPPGlobals.h:133
long long int64
Sun defines long as int ... this defines long long as a true long (int64).
Definition: CPPGlobals.h:83
unsigned char uByte
Unsigned-byte typedef.
Definition: CPPGlobals.h:88