SUMOTime.h
Go to the documentation of this file.00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SUMOTime_h
00020 #define SUMOTime_h
00021
00022
00023
00024
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
00038
00039 typedef int SUMOTime;
00040 #define SUMOTime_MAX INT_MAX
00041
00042 #ifndef HAVE_SUBSECOND_TIMESTEPS
00043
00044 #define DELTA_T 1
00045
00046 #define TS (static_cast<SUMOReal>(1.))
00047
00048
00049 #define SPEED2DIST(x) (x)
00050
00051 #define DIST2SPEED(x) (x)
00052
00053 #define ACCEL2DIST(x) (x)
00054
00055 #define ACCEL2SPEED(x) (x)
00056
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
00065 extern SUMOTime DELTA_T;
00066
00067 #define TS (static_cast<SUMOReal>(DELTA_T/1000.))
00068
00069
00070 #define SPEED2DIST(x) ((x)*TS)
00071
00072 #define DIST2SPEED(x) ((x)/TS)
00073
00074 #define ACCEL2DIST(x) ((x)*TS*TS)
00075
00076 #define ACCEL2SPEED(x) ((x)*TS)
00077
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
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