Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Parse Class Reference

#include <Parse.h>

List of all members.

Static Public Methods

double parseFirstDouble (char **strMsg)
int parseFirstInt (char **strMsg)
char gotoFirstSpaceOrClosingBracket (char **strMsg)
int gotoFirstOccurenceOf (char c, char **strMsg)
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

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, '\0' 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().

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::gotoFirstSpaceOrClosingBracket char **    strMsg [static]
 

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

  • the end of the string is reached
  • a character different than ' ' and ')' is read
    strMsg is changed after this method is called.
Parameters:
strMsg  pointer to a character in a string array
Returns:
first character that is not equal to ' ' or ')', '\0' when string didn't contain such a character.

Definition at line 79 of file Parse.cpp.

Referenced by SoccerTypes::getObjectFromStr().

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().


The documentation for this class was generated from the following files:
Generated on Fri Nov 7 11:46:04 2003 for UvA Trilearn 2003 Base Code by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001