SUMO - Simulation of Urban MObility
StdDefs.h
Go to the documentation of this file.
00001 /****************************************************************************/
00009 //
00010 /****************************************************************************/
00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00013 /****************************************************************************/
00014 //
00015 //   This file is part of SUMO.
00016 //   SUMO is free software: you can redistribute it and/or modify
00017 //   it under the terms of the GNU General Public License as published by
00018 //   the Free Software Foundation, either version 3 of the License, or
00019 //   (at your option) any later version.
00020 //
00021 /****************************************************************************/
00022 #ifndef StdDefs_h
00023 #define StdDefs_h
00024 
00025 
00026 // ===========================================================================
00027 // included modules
00028 // ===========================================================================
00029 #ifdef _MSC_VER
00030 #include <windows_config.h>
00031 #else
00032 #include <config.h>
00033 #endif
00034 
00035 /* avoiding compiler warning unreferenced parameter */
00036 #define UNUSED_PARAMETER(x)  ((void)(x))
00037 
00038 /* -------------------------------------------------------------------------
00039  * some constant defaults used by SUMO
00040  * ----------------------------------------------------------------------- */
00041 const SUMOReal SUMO_const_laneWidth = (SUMOReal) 3.2;
00042 const SUMOReal SUMO_const_halfLaneWidth = (SUMOReal) 1.6;
00043 const SUMOReal SUMO_const_quarterLaneWidth = (SUMOReal) 0.8;
00044 const SUMOReal SUMO_const_laneOffset = (SUMOReal) .1;
00045 const SUMOReal SUMO_const_laneWidthAndOffset = (SUMOReal) 3.3;
00046 const SUMOReal SUMO_const_halfLaneAndOffset = (SUMOReal)(3.2 / 2. + .1);
00047 
00048 
00049 /* -------------------------------------------------------------------------
00050  * templates for mathematical functions missing in some c++-implementations
00051  * ----------------------------------------------------------------------- */
00052 template<typename T>
00053 inline T
00054 MIN2(T a, T b) {
00055     return a < b ? a : b;
00056 }
00057 
00058 template<typename T>
00059 inline T
00060 MAX2(T a, T b) {
00061     return a > b ? a : b;
00062 }
00063 
00064 
00065 template<typename T>
00066 inline T
00067 MIN3(T a, T b, T c) {
00068     return MIN2(c, a < b ? a : b);
00069 }
00070 
00071 
00072 template<typename T>
00073 inline T
00074 MAX3(T a, T b, T c) {
00075     return MAX2(c, a > b ? a : b);
00076 }
00077 
00078 
00079 template<typename T>
00080 inline T
00081 MIN4(T a, T b, T c, T d) {
00082     return MIN2(MIN2(a, b), MIN2(c, d));
00083 }
00084 
00085 
00086 template<typename T>
00087 inline T
00088 MAX4(T a, T b, T c, T d) {
00089     return MAX2(MAX2(a, b), MAX2(c, d));
00090 }
00091 
00092 
00093 template<typename T>
00094 inline T
00095 ISNAN(T a) {
00096     volatile T d = a;
00097     return d != d;
00098 }
00099 
00100 
00101 #endif
00102 
00103 /****************************************************************************/
00104 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines