Parse Class Reference

#include <Parse.h>


Static Public Member Functions

static double parseFirstDouble (char **strMsg)
static int parseFirstInt (char **strMsg)
static char gotoFirstSpaceOrClosingBracket (char **strMsg)
static int gotoFirstOccurenceOf (char c, char **strMsg)
static char gotoFirstNonSpace (char **strMsg)


Detailed Description

This class contains several static methods which can be used for parsing string messages and uses some of the ideas contained in CMU'99 source code of Peter Stone. Tests shows that scanning integers has a performance increase of 30.3% over the method used by CMUnited and 68.0% over sscanf. For parsing doubles the performance increase was 15.4% compared to CMUnited and 85.1% compared to sscanf.

Definition at line 61 of file Parse.h.


Member Function Documentation

double Parse::parseFirstDouble ( char **  strMsg  )  [static]

This method walks through the string starting at the character where strMsg points to and returns the first double that can be read from this string. Any other characters in front of this integer are discarded. After this method is returned, strMsg points to the first character after the final value of the double. 4e-3, and NaN or nan are also recognized. When input contains NaN or nan, -1000.0 is returned.

Parameters:
strMsg pointer to a character in a string array
Returns:
first double that can be read from this string.

Definition at line 145 of file Parse.cpp.

References parseFirstInt().

Referenced by SenseHandler::analyzeFullStateMessage(), SenseHandler::analyzePlayerTypeMessage(), SenseHandler::analyzeSeeGlobalMessage(), Player::executeStringCommand(), BasicCoach::executeStringCommand(), main(), WorldModel::processLastSeeMessage(), WorldModel::processLastSenseMessage(), and Formations::readFormations().

int Parse::parseFirstInt ( char **  strMsg  )  [static]

This method walks through the string starting at the character where strMsg points to and returns the first integer that can be read from this string. Any other characters in front of this integer are discarded. After this method is returned, strMsg points to the first character after the final value of the integer.

Parameters:
strMsg pointer to a character in a string array
Returns:
first integer that can be read from this string.

Definition at line 112 of file Parse.cpp.

Referenced by SenseHandler::analyzeChangePlayerTypeMessage(), SenseHandler::analyzeCheckBall(), SenseHandler::analyzeFullStateMessage(), SenseHandler::analyzeHearMessage(), SenseHandler::analyzeInitMessage(), SenseHandler::analyzePlayerMessage(), SenseHandler::analyzePlayerTypeMessage(), SenseHandler::analyzeSeeGlobalMessage(), SenseHandler::analyzeSeeMessage(), SenseHandler::analyzeSenseMessage(), Player::executeStringCommand(), BasicCoach::executeStringCommand(), SoccerTypes::getObjectFromStr(), main(), parseFirstDouble(), WorldModel::processLastSeeMessage(), WorldModel::processLastSenseMessage(), WorldModel::processPlayerMessage(), and Formations::readFormations().

char Parse::gotoFirstSpaceOrClosingBracket ( char **  strMsg  )  [static]

This method walks through the string starting at the character where strMsg points to and stops when

Definition at line 79 of file Parse.cpp.

Referenced by SoccerTypes::getObjectFromStr().

int Parse::gotoFirstOccurenceOf ( char  c,
char **  strMsg 
) [static]

This method walks through the string starting at the character where strMsg points to and stops when the character c is reached. strMsg is changed after this method is called..

Parameters:
c character that is searched for in strMsg.
strMsg pointer to a character in a string array
Returns:
number of character skipped to reach c, -1 when not found

Definition at line 92 of file Parse.cpp.

Referenced by SenseHandler::analyzeFullStateMessage(), SenseHandler::analyzeHearMessage(), SenseHandler::analyzeSeeGlobalMessage(), Player::executeStringCommand(), WorldModel::getMaxRangeUnknownPlayer(), SoccerTypes::getObjectFromStr(), WorldModel::processLastSeeMessage(), and WorldModel::processLastSenseMessage().

char Parse::gotoFirstNonSpace ( char **  strMsg  )  [static]

This method walks through the string starting at the character where strMsg points to and stops when or the end of the string is reached or a non space is reached. strMsg is updated to this new position.

Parameters:
strMsg pointer to a character in a string array
Returns:
character that is at the first non space, '' when end of string is reached.

Definition at line 63 of file Parse.cpp.

Referenced by SenseHandler::analyzeHearMessage(), SenseHandler::analyzePlayerMessage(), Player::executeStringCommand(), and Formations::readFormations().


The documentation for this class was generated from the following files:
Generated on Thu Apr 26 22:45:31 2007 for GangOfSix(GOS)-RoboCupTeamProject by  doxygen 1.5.1-p1