SUMO - Simulation of Urban MObility

StdDefs.h

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