#include <SoccerTypes.h>
Public Member Functions | |
Time (int iTime=-1, int iStopped=0) | |
bool | updateTime (int iTime) |
bool | setTimeStopped (int iTime) |
int | getTime () |
int | getTimeStopped () |
int | getTimeDifference (Time t) |
bool | isStopped () |
Time | getTimeAddedWith (int iCycles) |
bool | addToTime (int iCycles) |
void | show (ostream &os=cout) |
Time | operator+ (const int &i) |
Time | operator+ (Time t) |
Time | operator- (const int &i) |
int | operator- (Time t) |
void | operator= (const int &i) |
void | operator+= (Time t) |
void | operator+= (const int &i) |
void | operator-= (Time t) |
void | operator-= (const int &i) |
bool | operator!= (Time t) |
bool | operator!= (const int &i) |
bool | operator== (Time t) |
bool | operator== (const int &i) |
bool | operator< (Time t) |
bool | operator< (const int &i) |
bool | operator<= (Time t) |
bool | operator<= (const int &i) |
bool | operator> (Time t) |
bool | operator> (const int &i) |
bool | operator>= (Time t) |
bool | operator>= (const int &i) |
Private Attributes | |
int | m_iTime |
int | m_iStopped |
Friends | |
ostream & | operator<< (ostream &os, Time t) |
Definition at line 528 of file SoccerTypes.h.
Time::Time | ( | int | iTime = -1 , |
|
int | iStopped = 0 | |||
) |
This is the constructor for the Time class, it receives two arguments. The actual time and how long the time has stopped.
iTime | actual time | |
iStopped | number of cycles time stopped |
Definition at line 75 of file SoccerTypes.cpp.
References m_iStopped, and m_iTime.
Referenced by getTimeAddedWith(), operator!=(), operator+(), and operator<().
bool Time::updateTime | ( | int | iTime | ) |
This method updates the time to 'iTime'. When the actual time was already 'iTime' the current time is kept unchanged and the time stopped is raised with one. Otherwise the actual time is changed to 'iTime' and the stopped time is set to 0.
iTime | new time |
Definition at line 87 of file SoccerTypes.cpp.
References m_iStopped, and m_iTime.
Referenced by SenseHandler::analyzeFullStateMessage(), SenseHandler::analyzeSeeGlobalMessage(), SenseHandler::analyzeSenseMessage(), BasicPlayer::getInterceptionPointBall(), operator+=(), operator-=(), operator=(), and WorldModel::updateAgentAndBallAfterSense().
bool Time::setTimeStopped | ( | int | iTime | ) |
This methods sets the stopped time, which denotes the number of cycles time stood still.
iTime | new stopped time |
Definition at line 103 of file SoccerTypes.cpp.
References m_iStopped.
Referenced by operator+=(), operator-=(), and operator=().
int Time::getTime | ( | ) |
This method returns the actual time, that is the number of cycles that have passed.
Definition at line 112 of file SoccerTypes.cpp.
References m_iTime.
Referenced by SenseHandler::analyzeFullStateMessage(), SenseHandler::analyzeSeeMessage(), SenseHandler::analyzeSenseMessage(), Object::getConfidence(), WorldModel::getCurrentCycle(), getTimeAddedWith(), getTimeDifference(), WorldModel::getTimeSinceLastCatch(), BasicCoach::mainLoopNormal(), WorldModel::mapUnknownPlayers(), operator+(), operator+=(), operator-=(), operator<<(), BasicPlayer::oscillateView(), WorldModel::predictNrCyclesToPoint(), WorldModel::processPlayerMessage(), BasicPlayer::searchBall(), WorldModel::show(), show(), BasicPlayer::turnAround(), and WorldModel::updateAgentAndBallAfterSense().
int Time::getTimeStopped | ( | ) |
This method returns the time the time has stopped, that is the number of cycles the time stood on the current value.
Definition at line 120 of file SoccerTypes.cpp.
References m_iStopped.
Referenced by SenseHandler::analyzeSenseMessage(), getTimeAddedWith(), getTimeDifference(), WorldModel::mapUnknownPlayers(), operator+(), operator+=(), operator<<(), and show().
int Time::getTimeDifference | ( | Time | t | ) |
This method returns the time difference between two time objects.
t | Time with which current time should be compared |
Definition at line 128 of file SoccerTypes.cpp.
References getTime(), and getTimeStopped().
Referenced by SenseHandler::analyzeSeeMessage(), SenseHandler::analyzeSenseMessage(), Object::getConfidence(), operator!=(), operator-(), and operator<().
bool Time::isStopped | ( | ) |
This method returns a boolean value indicating whether the time currently is stopped.
Definition at line 142 of file SoccerTypes.cpp.
References m_iStopped.
Referenced by WorldModel::isTimeStopped().
Time Time::getTimeAddedWith | ( | int | iCycles | ) |
This method returns a new time class denoting the time when 'iCycles' are added to the current time. There are different situations possible. When the added time is positive and the time stands still, the cycles are added to the stopped time, otherwise they are added to the actual time. When the added time is negative and the time stands still, the cycles are subtracted from the stopped time. Otherwise the time is subtracted from the actual time.
iCycles | denotes the time that should be added (when negative subtracted) to the current time |
Definition at line 161 of file SoccerTypes.cpp.
References getTime(), getTimeStopped(), and Time().
Referenced by addToTime(), operator+(), and operator-().
bool Time::addToTime | ( | int | iCycles | ) |
This method adds 'iCycles' to the current time. The current values are updated. The method getTimeAddedWith is used to calculated the new time.
iCycles | time added to the current time |
Definition at line 195 of file SoccerTypes.cpp.
References getTimeAddedWith().
Referenced by operator+=(), and operator-=().
void Time::show | ( | ostream & | os = cout |
) |
This method prints the time to the specified output stream. Time is printed as the two tuple (t,s) where t denotes the actual time and s the number of stopped cycles.
os | output stream to which output is written (default cout) |
Definition at line 205 of file SoccerTypes.cpp.
References getTime(), and getTimeStopped().
Time Time::operator+ | ( | const int & | i | ) |
This method returns the time as if 'i' cycles would be added to the current time. The method getTimeAddedWith is used for this. No changes are made to the current object.
iCycles | denotes the time that should be added to the current time |
Definition at line 215 of file SoccerTypes.cpp.
References getTimeAddedWith().
This method returns the result of adding time 't' to the current time. No changes are made to the current object. It is defined by (t1,s1) + (t2,s2) = (t1+t2,s2). The stopped time of the first time tuple is neglected, since this has already been passed.
t | Time object that should be added to the current time |
Definition at line 226 of file SoccerTypes.cpp.
References getTime(), getTimeStopped(), and Time().
Time Time::operator- | ( | const int & | i | ) |
This method returns the time as if 'i' cycles would be subtracted from the current time. The method getTimeAddedWith is used for this. No changes are made to the current object.
iCycles | denotes the time that should be subtracted from the time |
Definition at line 236 of file SoccerTypes.cpp.
References getTimeAddedWith().
int Time::operator- | ( | Time | t | ) |
This method returns the result the difference between the two times and is equal to the method getTimeDifference.
t | Time object that should be subtracted from the current time |
Definition at line 245 of file SoccerTypes.cpp.
References getTimeDifference().
void Time::operator= | ( | const int & | i | ) |
This method returns a new time object (i,0). The argument 'i' is thus denoted as the actual time.
i | new time |
Definition at line 254 of file SoccerTypes.cpp.
References setTimeStopped(), and updateTime().
void Time::operator+= | ( | Time | t | ) |
This method updates the time by adding the time 't' to the current time. It is defined by (t1,s1) + (t2,s2) = (t1+t2,s2). The stopped time of the first time tuple is neglected, since this has already been passed.
t | Time object that should be added to the current time |
Definition at line 273 of file SoccerTypes.cpp.
References getTime(), getTimeStopped(), setTimeStopped(), and updateTime().
void Time::operator+= | ( | const int & | i | ) |
This method updates the time by adding 'i' cycles to the current time. The method addToTime is used for this.
i | denotes the time that should be added to the current time |
Definition at line 263 of file SoccerTypes.cpp.
References addToTime().
void Time::operator-= | ( | Time | t | ) |
This method updates the time by subtracting time 't' from the current time. It is defined by (t1,s1) + (t2,s2) = (t1-t2,0). The stopped time is set to zero.
t | Time object that should be subtracted from the current time |
Definition at line 292 of file SoccerTypes.cpp.
References getTime(), setTimeStopped(), and updateTime().
void Time::operator-= | ( | const int & | i | ) |
This method updates the time by subtractign 'i' cycles from the current time. The method addToTime is used for this with '-i' as its argument.
i | denotes the time that should be subtracted |
Definition at line 283 of file SoccerTypes.cpp.
References addToTime().
bool Time::operator!= | ( | Time | t | ) |
This method returns a boolean indicating whether the current time is inequal to the time t. When the time difference returned by getTimeDifference between these two time objects is inequal to zero true is returned, false otherwise.
t | time with which current time should be compared |
Definition at line 319 of file SoccerTypes.cpp.
References getTimeDifference().
bool Time::operator!= | ( | const int & | i | ) |
This method returns a boolean indicating whether the current time is inequal to the time specified by the integer 'i'. 'i' is first converted to the time object (i,0). When the time difference returned by getTimeDifference between these two time objects is inequal to zero true is returned, false otherwise
i | actual time with which current time should be compared |
Definition at line 307 of file SoccerTypes.cpp.
References getTimeDifference(), and Time().
bool Time::operator== | ( | Time | t | ) |
This method returns a boolean indicating whether the current time equals the time t. When the time difference returned by getTimeDifference between these two time objects equals zero, true is returned, false otherwise
t | time with which current time should be compared |
Definition at line 342 of file SoccerTypes.cpp.
bool Time::operator== | ( | const int & | i | ) |
This method returns a boolean indicating whether the current time equals the time as specified by the integer 'i'. 'i' is first converted to the time object (i,0). When the time difference returned by getTimeDifference between these two time objects equals zero, true is returned, false otherwise
i | actual time with which current time should be compared |
Definition at line 332 of file SoccerTypes.cpp.
bool Time::operator< | ( | Time | t | ) |
This method returns a boolean indicating whether the current time is smaller than the time t. When the time difference returned by getTimeDifference is smaller than zero, true is returned, false otherwise
t | time with which current time should be compared |
Definition at line 354 of file SoccerTypes.cpp.
References getTimeDifference().
bool Time::operator< | ( | const int & | i | ) |
This method returns a boolean indicating whether the current time is smaller than the time denoted by the integer 'i'. Herefore first a time object (i,0) is created.
t | time with which current time should be compared |
Definition at line 365 of file SoccerTypes.cpp.
References Time().
bool Time::operator<= | ( | Time | t | ) |
This method returns a boolean indicating whether the current time is smaller than or equal to the time t.
t | time with which current time should be compared |
Definition at line 376 of file SoccerTypes.cpp.
bool Time::operator<= | ( | const int & | i | ) |
This method returns a boolean indicating whether the current time is smaller than or equal to the time denoted by the integer 'i'. Herefore first a time object (i,0) is created.
t | time with which current time should be compared |
Definition at line 388 of file SoccerTypes.cpp.
bool Time::operator> | ( | Time | t | ) |
This method returns a boolean indicating whether the current time is larger than the time t, that is it is not smaller than or equal to 't'.
t | time with which current time should be compared |
Definition at line 397 of file SoccerTypes.cpp.
bool Time::operator> | ( | const int & | i | ) |
This method returns a boolean indicating whether the current time is larger than the time denoted by the integer 'i'. Herefore first a time object (i,0) is created.
t | time with which current time should be compared |
Definition at line 410 of file SoccerTypes.cpp.
bool Time::operator>= | ( | Time | t | ) |
This method returns a boolean indicating whether the current time is larger than or equal to than the time t, that is it is not smaller than 't'.
t | time with which current time should be compared |
Definition at line 419 of file SoccerTypes.cpp.
bool Time::operator>= | ( | const int & | i | ) |
This method returns a boolean indicating whether the current time is larger than or equal to the time denoted by the integer 'i'. Herefore first a time object (i,0) is created.
t | time with which current time should be compared |
Definition at line 431 of file SoccerTypes.cpp.
ostream& operator<< | ( | ostream & | os, | |
Time | t | |||
) | [friend] |
Overloaded version of the C++ output operator for a Time class. This operator makes it possible to use Time objects in output statements (e.g. cout << t). The current cycle and the stopped time are printed in the format (t1,t2).
os | output stream to which information should be written | |
v | a Time object which must be printed |
Definition at line 443 of file SoccerTypes.cpp.
int Time::m_iTime [private] |
Number of cycles, denoting the time
Definition at line 530 of file SoccerTypes.h.
Referenced by getTime(), Time(), and updateTime().
int Time::m_iStopped [private] |
Number of cycles stopped at m_iTime
Definition at line 531 of file SoccerTypes.h.
Referenced by getTimeStopped(), isStopped(), setTimeStopped(), Time(), and updateTime().