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