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.sourceforge.net/
12 // Copyright (C) 2001-2012 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 
35 /* avoiding compiler warning unreferenced parameter */
36 #define UNUSED_PARAMETER(x) ((void)(x))
37 
38 /* -------------------------------------------------------------------------
39  * some constant defaults used by SUMO
40  * ----------------------------------------------------------------------- */
47 
48 
49 /* -------------------------------------------------------------------------
50  * templates for mathematical functions missing in some c++-implementations
51  * ----------------------------------------------------------------------- */
52 template<typename T>
53 inline T
54 MIN2(T a, T b) {
55  return a < b ? a : b;
56 }
57 
58 template<typename T>
59 inline T
60 MAX2(T a, T b) {
61  return a > b ? a : b;
62 }
63 
64 
65 template<typename T>
66 inline T
67 MIN3(T a, T b, T c) {
68  return MIN2(c, a < b ? a : b);
69 }
70 
71 
72 template<typename T>
73 inline T
74 MAX3(T a, T b, T c) {
75  return MAX2(c, a > b ? a : b);
76 }
77 
78 
79 template<typename T>
80 inline T
81 MIN4(T a, T b, T c, T d) {
82  return MIN2(MIN2(a, b), MIN2(c, d));
83 }
84 
85 
86 template<typename T>
87 inline T
88 MAX4(T a, T b, T c, T d) {
89  return MAX2(MAX2(a, b), MAX2(c, d));
90 }
91 
92 
93 template<typename T>
94 inline T
95 ISNAN(T a) {
96  volatile T d = a;
97  return d != d;
98 }
99 
100 
101 #endif
102 
103 /****************************************************************************/
104