SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StdDefs.h
Go to the documentation of this file.
1 /****************************************************************************/
9 //
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef StdDefs_h
23 #define StdDefs_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
36 
37 /* avoiding compiler warning unreferenced parameter */
38 #define UNUSED_PARAMETER(x) ((void)(x))
39 
40 class RGBColor;
41 
42 /* -------------------------------------------------------------------------
43  * some constant defaults used by SUMO
44  * ----------------------------------------------------------------------- */
51 
54 
55 /* @brief map from LinkState to color constants (see above)
56  */
57 const RGBColor& getLinkColor(const LinkState& ls);
58 
59 
60 /* -------------------------------------------------------------------------
61  * templates for mathematical functions missing in some c++-implementations
62  * ----------------------------------------------------------------------- */
63 template<typename T>
64 inline T
65 MIN2(T a, T b) {
66  return a < b ? a : b;
67 }
68 
69 template<typename T>
70 inline T
71 MAX2(T a, T b) {
72  return a > b ? a : b;
73 }
74 
75 
76 template<typename T>
77 inline T
78 MIN3(T a, T b, T c) {
79  return MIN2(c, a < b ? a : b);
80 }
81 
82 
83 template<typename T>
84 inline T
85 MAX3(T a, T b, T c) {
86  return MAX2(c, a > b ? a : b);
87 }
88 
89 
90 template<typename T>
91 inline T
92 MIN4(T a, T b, T c, T d) {
93  return MIN2(MIN2(a, b), MIN2(c, d));
94 }
95 
96 
97 template<typename T>
98 inline T
99 MAX4(T a, T b, T c, T d) {
100  return MAX2(MAX2(a, b), MAX2(c, d));
101 }
102 
103 
104 template<typename T>
105 inline T
106 ISNAN(T a) {
107  volatile T d = a;
108  return d != d;
109 }
110 
112 extern bool gDebugFlag1;
113 extern bool gDebugFlag2;
114 
115 #endif
116 
117 /****************************************************************************/
118 
const SUMOReal SUMO_const_laneWidth
Definition: StdDefs.h:45
bool gDebugFlag2
Definition: StdDefs.cpp:83
const SUMOReal SUMO_const_halfLaneAndOffset
Definition: StdDefs.h:50
T MIN4(T a, T b, T c, T d)
Definition: StdDefs.h:92
const SUMOReal SUMO_const_laneWidthAndOffset
Definition: StdDefs.h:49
bool gDebugFlag1
global utility flags for debugging
Definition: StdDefs.cpp:82
T MAX2(T a, T b)
Definition: StdDefs.h:71
const SUMOReal SUMO_const_laneOffset
Definition: StdDefs.h:48
T MAX3(T a, T b, T c)
Definition: StdDefs.h:85
const RGBColor & getLinkColor(const LinkState &ls)
Definition: StdDefs.cpp:49
T MAX4(T a, T b, T c, T d)
Definition: StdDefs.h:99
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:65
const SUMOReal SUMO_const_quarterLaneWidth
Definition: StdDefs.h:47
T ISNAN(T a)
Definition: StdDefs.h:106
const SUMOReal SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:53
#define SUMOReal
Definition: config.h:215
T MIN3(T a, T b, T c)
Definition: StdDefs.h:78
const SUMOReal SUMO_const_halfLaneWidth
Definition: StdDefs.h:46