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 2001-2010 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 
00033 /* -------------------------------------------------------------------------
00034  * some constant defaults used by SUMO
00035  * ----------------------------------------------------------------------- */
00036 const SUMOReal SUMO_const_laneWidth = (SUMOReal) 3.2;
00037 const SUMOReal SUMO_const_halfLaneWidth = (SUMOReal) 1.6;
00038 const SUMOReal SUMO_const_quarterLaneWidth = (SUMOReal) 0.8;
00039 const SUMOReal SUMO_const_laneOffset = (SUMOReal) .1;
00040 const SUMOReal SUMO_const_laneWidthAndOffset = (SUMOReal) 3.3;
00041 const SUMOReal SUMO_const_halfLaneAndOffset = (SUMOReal)(3.2/2.+.1);
00042 
00043 
00044 /* -------------------------------------------------------------------------
00045  * definitions of common used conversions
00046  * ----------------------------------------------------------------------- */
00047 #define mBYs2kmBYh(x) ((SUMOReal) (x/3.6))
00048 
00049 
00050 /* -------------------------------------------------------------------------
00051  * templates for mathematical functions missing in some c++-implementations
00052  * ----------------------------------------------------------------------- */
00053 template<typename T>
00054 inline T
00055 MIN2(T a, T b) {
00056     return a<b?a:b;
00057 }
00058 
00059 template<typename T>
00060 inline T
00061 MAX2(T a, T b) {
00062     return a>b?a:b;
00063 }
00064 
00065 
00066 template<typename T>
00067 inline T
00068 MIN3(T a, T b, T c) {
00069     return MIN2(c, a<b?a:b);
00070 }
00071 
00072 
00073 template<typename T>
00074 inline T
00075 MAX3(T a, T b, T c) {
00076     return MAX2(c, a>b?a:b);
00077 }
00078 
00079 
00080 template<typename T>
00081 inline T
00082 MIN4(T a, T b, T c, T d) {
00083     return MIN2(MIN2(a,b),MIN2(c,d));
00084 }
00085 
00086 
00087 template<typename T>
00088 inline T
00089 MAX4(T a, T b, T c, T d) {
00090     return MAX2(MAX2(a,b),MAX2(c,d));
00091 }
00092 
00093 
00094 #endif
00095 
00096 /****************************************************************************/
00097 

Generated on Wed May 5 00:06:36 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6