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-2015 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 
37 
38 /* avoiding compiler warning unreferenced parameter */
39 #define UNUSED_PARAMETER(x) ((void)(x))
40 
42 #define SUMO_MAX_CONNECTIONS 256
43 
44 class RGBColor;
45 
46 /* -------------------------------------------------------------------------
47  * some constant defaults used by SUMO
48  * ----------------------------------------------------------------------- */
55 
58 
59 /* @brief map from LinkState to color constants (see above)
60  */
61 const RGBColor& getLinkColor(const LinkState& ls);
62 
64 const std::string getBuildName(const std::string& version);
65 
66 
67 
68 /* -------------------------------------------------------------------------
69  * templates for mathematical functions missing in some c++-implementations
70  * ----------------------------------------------------------------------- */
71 template<typename T>
72 inline T
73 MIN2(T a, T b) {
74  return a < b ? a : b;
75 }
76 
77 template<typename T>
78 inline T
79 MAX2(T a, T b) {
80  return a > b ? a : b;
81 }
82 
83 
84 template<typename T>
85 inline T
86 MIN3(T a, T b, T c) {
87  return MIN2(c, a < b ? a : b);
88 }
89 
90 
91 template<typename T>
92 inline T
93 MAX3(T a, T b, T c) {
94  return MAX2(c, a > b ? a : b);
95 }
96 
97 
98 template<typename T>
99 inline T
100 MIN4(T a, T b, T c, T d) {
101  return MIN2(MIN2(a, b), MIN2(c, d));
102 }
103 
104 
105 template<typename T>
106 inline T
107 MAX4(T a, T b, T c, T d) {
108  return MAX2(MAX2(a, b), MAX2(c, d));
109 }
110 
111 
112 template<typename T>
113 inline T
114 ISNAN(T a) {
115  volatile T d = a;
116  return d != d;
117 }
118 
120 extern bool gDebugFlag1;
121 extern bool gDebugFlag2;
122 
123 extern std::string gDebugSelectedVehicle;
124 
125 #endif
126 
127 /****************************************************************************/
128 
const std::string getBuildName(const std::string &version)
attach some build flags to the version string
Definition: StdDefs.cpp:91
const SUMOReal SUMO_const_laneWidth
Definition: StdDefs.h:49
bool gDebugFlag2
Definition: StdDefs.cpp:103
const SUMOReal SUMO_const_halfLaneAndOffset
Definition: StdDefs.h:54
T MIN4(T a, T b, T c, T d)
Definition: StdDefs.h:100
const SUMOReal SUMO_const_laneWidthAndOffset
Definition: StdDefs.h:53
bool gDebugFlag1
global utility flags for debugging
Definition: StdDefs.cpp:102
T MAX2(T a, T b)
Definition: StdDefs.h:79
const SUMOReal SUMO_const_laneOffset
Definition: StdDefs.h:52
T MAX3(T a, T b, T c)
Definition: StdDefs.h:93
const RGBColor & getLinkColor(const LinkState &ls)
Definition: StdDefs.cpp:53
std::string gDebugSelectedVehicle
Definition: StdDefs.cpp:104
T MAX4(T a, T b, T c, T d)
Definition: StdDefs.h:107
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
T MIN2(T a, T b)
Definition: StdDefs.h:73
const SUMOReal SUMO_const_quarterLaneWidth
Definition: StdDefs.h:51
T ISNAN(T a)
Definition: StdDefs.h:114
const SUMOReal SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:57
#define SUMOReal
Definition: config.h:214
T MIN3(T a, T b, T c)
Definition: StdDefs.h:86
const SUMOReal SUMO_const_halfLaneWidth
Definition: StdDefs.h:50