classparse.html

来自「仿真人工智能是指用人工的方法和技术」· HTML 代码 · 共 257 行

HTML
257
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Parse class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body bgcolor="#ffffff"><!-- Generated by Doxygen 1.2.12 --><center><a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center><hr><h1>Parse  Class Reference</h1><code>#include &lt;<a class="el" href="Parse_8h-source.html">Parse.h</a>&gt;</code><p><a href="classParse-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td colspan=2><br><h2>Static Public Methods</h2></td></tr><tr><td nowrap align=right valign=top>double&nbsp;</td><td valign=bottom><a class="el" href="classParse.html#d0">parseFirstDouble</a> (char **strMsg)</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classParse.html#d1">parseFirstInt</a> (char **strMsg)</td></tr><tr><td nowrap align=right valign=top>char&nbsp;</td><td valign=bottom><a class="el" href="classParse.html#d2">gotoFirstSpaceOrClosingBracket</a> (char **strMsg)</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classParse.html#d3">gotoFirstOccurenceOf</a> (char c, char **strMsg)</td></tr><tr><td nowrap align=right valign=top>char&nbsp;</td><td valign=bottom><a class="el" href="classParse.html#d4">gotoFirstNonSpace</a> (char **strMsg)</td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>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. <p><p>Definition at line <a class="el" href="Parse_8h-source.html#l00056">56</a> of file <a class="el" href="Parse_8h-source.html">Parse.h</a>.<hr><h2>Member Function Documentation</h2><a name="d4" doxytag="Parse::gotoFirstNonSpace"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> char Parse::gotoFirstNonSpace </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">char **&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>strMsg</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap><code> [static]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>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. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>strMsg</em>&nbsp;</td><td>pointer to a character in a string array </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>character that is at the first non space, '\0' when end of string is reached. </dl><p>Definition at line <a class="el" href="Parse_8C-source.html#l00058">58</a> of file <a class="el" href="Parse_8C-source.html">Parse.C</a>.<p>Referenced by <a class="el" href="SenseHandler_8C-source.html#l00428">SenseHandler::analyzeHearMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00493">SenseHandler::analyzePlayerMessage</a>(), <a class="el" href="Player_8C-source.html#l00512">Player::executeStringCommand</a>(), and <a class="el" href="Formations_8C-source.html#l00534">Formations::readFormations</a>().    </td>  </tr></table><a name="d3" doxytag="Parse::gotoFirstOccurenceOf"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> int Parse::gotoFirstOccurenceOf </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">char&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>c</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>char **&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>strMsg</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"><code> [static]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>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.. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>c</em>&nbsp;</td><td>character that is searched for in strMsg. </td></tr><tr><td valign=top><em>strMsg</em>&nbsp;</td><td>pointer to a character in a string array </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>number of character skipped to reach c, -1 when not found </dl><p>Definition at line <a class="el" href="Parse_8C-source.html#l00087">87</a> of file <a class="el" href="Parse_8C-source.html">Parse.C</a>.<p>Referenced by <a class="el" href="SenseHandler_8C-source.html#l00428">SenseHandler::analyzeHearMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00493">SenseHandler::analyzePlayerMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00345">SenseHandler::analyzeSenseMessage</a>(), <a class="el" href="Player_8C-source.html#l00512">Player::executeStringCommand</a>(), and <a class="el" href="SoccerTypes_8C-source.html#l00885">SoccerTypes::getObjectFromStr</a>().    </td>  </tr></table><a name="d2" doxytag="Parse::gotoFirstSpaceOrClosingBracket"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> char Parse::gotoFirstSpaceOrClosingBracket </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">char **&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>strMsg</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap><code> [static]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This method walks through the string starting at the character where strMsg points to and stops when<br><ul><li>the end of the string is reached<br><li>a character different than ' ' and ')' is read<br> strMsg is changed after this method is called. </ul><dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>strMsg</em>&nbsp;</td><td>pointer to a character in a string array </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>first character that is not equal to ' ' or ')', '\0' when string didn't contain such a character. </dl><p>Definition at line <a class="el" href="Parse_8C-source.html#l00074">74</a> of file <a class="el" href="Parse_8C-source.html">Parse.C</a>.<p>Referenced by <a class="el" href="SoccerTypes_8C-source.html#l00885">SoccerTypes::getObjectFromStr</a>().    </td>  </tr></table><a name="d0" doxytag="Parse::parseFirstDouble"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> double Parse::parseFirstDouble </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">char **&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>strMsg</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap><code> [static]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>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. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>strMsg</em>&nbsp;</td><td>pointer to a character in a string array </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>first double that can be read from this string. </dl><p>Definition at line <a class="el" href="Parse_8C-source.html#l00140">140</a> of file <a class="el" href="Parse_8C-source.html">Parse.C</a>.<p>References <a class="el" href="Parse_8C-source.html#l00107">parseFirstInt</a>().<p>Referenced by <a class="el" href="SenseHandler_8C-source.html#l00493">SenseHandler::analyzePlayerMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00753">SenseHandler::analyzePlayerTypeMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00285">SenseHandler::analyzeSeeGlobalMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00206">SenseHandler::analyzeSeeMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00345">SenseHandler::analyzeSenseMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00637">SenseHandler::analyzeServerParamMessage</a>(), <a class="el" href="Player_8C-source.html#l00512">Player::executeStringCommand</a>(), <a class="el" href="main_8C-source.html#l00059">main</a>(), and <a class="el" href="Formations_8C-source.html#l00534">Formations::readFormations</a>().    </td>  </tr></table><a name="d1" doxytag="Parse::parseFirstInt"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> int Parse::parseFirstInt </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">char **&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>strMsg</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap><code> [static]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>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. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>strMsg</em>&nbsp;</td><td>pointer to a character in a string array </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>first integer that can be read from this string. </dl><p>Definition at line <a class="el" href="Parse_8C-source.html#l00107">107</a> of file <a class="el" href="Parse_8C-source.html">Parse.C</a>.<p>Referenced by <a class="el" href="SenseHandler_8C-source.html#l00620">SenseHandler::analyzeChangePlayerTypeMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00606">SenseHandler::analyzeCheckBall</a>(), <a class="el" href="SenseHandler_8C-source.html#l00428">SenseHandler::analyzeHearMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00404">SenseHandler::analyzeInitMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00493">SenseHandler::analyzePlayerMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00753">SenseHandler::analyzePlayerTypeMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00285">SenseHandler::analyzeSeeGlobalMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00206">SenseHandler::analyzeSeeMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00345">SenseHandler::analyzeSenseMessage</a>(), <a class="el" href="SenseHandler_8C-source.html#l00637">SenseHandler::analyzeServerParamMessage</a>(), <a class="el" href="Player_8C-source.html#l00512">Player::executeStringCommand</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00885">SoccerTypes::getObjectFromStr</a>(), <a class="el" href="main_8C-source.html#l00059">main</a>(), <a class="el" href="Parse_8C-source.html#l00140">parseFirstDouble</a>(), and <a class="el" href="Formations_8C-source.html#l00534">Formations::readFormations</a>().    </td>  </tr></table><hr>The documentation for this class was generated from the following files:<ul><li><a class="el" href="Parse_8h-source.html">Parse.h</a><li><a class="el" href="Parse_8C-source.html">Parse.C</a></ul><hr><address><small>Generated on Thu Mar 7 00:37:55 2002 for UvA Trilearn 2001 by<a href="http://www.doxygen.org/index.html"><img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.12 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, &copy;&nbsp;1997-2001</small></address></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?