SUMO - Simulation of Urban MObility
StdDefs.h
Go to the documentation of this file.
1 /****************************************************************************/
10 //
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef StdDefs_h
24 #define StdDefs_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 #include <string>
36 
37 /* avoiding compiler warning unreferenced parameter */
38 #define UNUSED_PARAMETER(x) ((void)(x))
39 
41 #define SUMO_MAX_CONNECTIONS 256
42 
43 class RGBColor;
44 
45 /* -------------------------------------------------------------------------
46  * some constant defaults used by SUMO
47  * ----------------------------------------------------------------------- */
48 const double SUMO_const_laneWidth = (double) 3.2;
49 const double SUMO_const_halfLaneWidth = (double) 1.6;
50 const double SUMO_const_quarterLaneWidth = (double) 0.8;
51 const double SUMO_const_laneOffset = (double) .1;
52 const double SUMO_const_laneWidthAndOffset = (double) 3.3;
53 const double SUMO_const_halfLaneAndOffset = (double)(3.2 / 2. + .1);
54 
56 const double SUMO_const_haltingSpeed = (double) 0.1;
57 
58 
59 /* -------------------------------------------------------------------------
60  * templates for mathematical functions missing in some c++-implementations
61  * ----------------------------------------------------------------------- */
62 template<typename T>
63 inline T
64 MIN2(T a, T b) {
65  return a < b ? a : b;
66 }
67 
68 template<typename T>
69 inline T
70 MAX2(T a, T b) {
71  return a > b ? a : b;
72 }
73 
74 
75 template<typename T>
76 inline T
77 MIN3(T a, T b, T c) {
78  return MIN2(c, a < b ? a : b);
79 }
80 
81 
82 template<typename T>
83 inline T
84 MAX3(T a, T b, T c) {
85  return MAX2(c, a > b ? a : b);
86 }
87 
88 
89 template<typename T>
90 inline T
91 MIN4(T a, T b, T c, T d) {
92  return MIN2(MIN2(a, b), MIN2(c, d));
93 }
94 
95 
96 template<typename T>
97 inline T
98 MAX4(T a, T b, T c, T d) {
99  return MAX2(MAX2(a, b), MAX2(c, d));
100 }
101 
102 
103 template<typename T>
104 inline T
105 ISNAN(T a) {
106  volatile T d = a;
107  return d != d;
108 }
109 
110 
112 extern int gPrecision;
113 extern int gPrecisionGeo; // for lon,lat
114 
115 
117 extern bool gDebugFlag1;
118 extern bool gDebugFlag2;
119 extern bool gDebugFlag3;
120 extern bool gDebugFlag4;
121 
122 extern std::string gDebugSelectedVehicle;
123 
124 #endif
125 
126 /****************************************************************************/
127 
int gPrecisionGeo
Definition: StdDefs.cpp:31
bool gDebugFlag2
Definition: StdDefs.cpp:34
T MIN4(T a, T b, T c, T d)
Definition: StdDefs.h:91
const double SUMO_const_halfLaneAndOffset
Definition: StdDefs.h:53
const double SUMO_const_laneWidth
Definition: StdDefs.h:48
const double SUMO_const_laneWidthAndOffset
Definition: StdDefs.h:52
bool gDebugFlag1
global utility flags for debugging
Definition: StdDefs.cpp:33
T MAX2(T a, T b)
Definition: StdDefs.h:70
const double SUMO_const_laneOffset
Definition: StdDefs.h:51
T MAX3(T a, T b, T c)
Definition: StdDefs.h:84
std::string gDebugSelectedVehicle
Definition: StdDefs.cpp:37
int gPrecision
the precision for floating point outputs
Definition: StdDefs.cpp:30
const double SUMO_const_halfLaneWidth
Definition: StdDefs.h:49
T MAX4(T a, T b, T c, T d)
Definition: StdDefs.h:98
T MIN2(T a, T b)
Definition: StdDefs.h:64
const double SUMO_const_quarterLaneWidth
Definition: StdDefs.h:50
T ISNAN(T a)
Definition: StdDefs.h:105
bool gDebugFlag4
Definition: StdDefs.cpp:36
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:56
T MIN3(T a, T b, T c)
Definition: StdDefs.h:77
bool gDebugFlag3
Definition: StdDefs.cpp:35