SUMOTime.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Variables, methods, and tools for internal time representation
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 SUMOTime_h
00020 #define SUMOTime_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 #include <string>
00033 #include "UtilExceptions.h"
00034 
00035 
00036 // ===========================================================================
00037 // type definitions
00038 // ===========================================================================
00039 typedef int SUMOTime;
00040 #define SUMOTime_MAX INT_MAX
00041 
00042 #ifndef HAVE_SUBSECOND_TIMESTEPS
00043 // the step length in s
00044 #define DELTA_T 1
00045 
00046 #define TS (static_cast<SUMOReal>(1.))
00047 
00048 // x*deltaT
00049 #define SPEED2DIST(x) (x)
00050 // x/deltaT
00051 #define DIST2SPEED(x) (x)
00052 // x*deltaT*deltaT
00053 #define ACCEL2DIST(x) (x)
00054 // x*deltaT
00055 #define ACCEL2SPEED(x) (x)
00056 // x/deltaT
00057 #define SPEED2ACCEL(x) (x)
00058 
00059 #define STEPS2TIME(x) (static_cast<SUMOReal>(x))
00060 #define TIME2STEPS(x) (static_cast<SUMOTime>(x))
00061 
00062 #else
00063 
00064 // the step length in s
00065 extern SUMOTime DELTA_T;
00066 
00067 #define TS (static_cast<SUMOReal>(DELTA_T/1000.))
00068 
00069 // x*deltaT
00070 #define SPEED2DIST(x) ((x)*TS)
00071 // x/deltaT
00072 #define DIST2SPEED(x) ((x)/TS)
00073 // x*deltaT*deltaT
00074 #define ACCEL2DIST(x) ((x)*TS*TS)
00075 // x*deltaT
00076 #define ACCEL2SPEED(x) ((x)*TS)
00077 // x*deltaT
00078 #define SPEED2ACCEL(x) ((x)/TS)
00079 
00080 #define STEPS2TIME(x) (static_cast<SUMOReal>((x)/1000.))
00081 #define TIME2STEPS(x) (static_cast<SUMOTime>((x)*1000))
00082 
00083 #endif
00084 
00085 
00086 // ===========================================================================
00087 // method declarations
00088 // ===========================================================================
00089 SUMOTime string2time(const std::string &r) throw(EmptyData, NumberFormatException);
00090 std::string time2string(SUMOTime t) throw();
00091 
00092 
00093 #endif
00094 
00095 /****************************************************************************/
00096 

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