classtime.html

来自「仿真人工智能是指用人工的方法和技术」· HTML 代码 · 共 1,421 行 · 第 1/4 页

HTML
1,421
字号
<!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>Time 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>Time  Class Reference</h1><code>#include &lt;<a class="el" href="SoccerTypes_8h-source.html">SoccerTypes.h</a>&gt;</code><p><a href="classTime-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td colspan=2><br><h2>Public Methods</h2></td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a0">Time</a> (int iTime=-1, int iStopped=0)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a1">updateTime</a> (int iTime)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a2">setTimeStopped</a> (int iTime)</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a3">getTime</a> ()</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a4">getTimeStopped</a> ()</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a5">getTimeDifference</a> (Time t)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a6">isStopped</a> ()</td></tr><tr><td nowrap align=right valign=top>Time&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a7">getTimeAddedWith</a> (int iCycles)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a8">addToTime</a> (int iCycles)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a9">show</a> (ostream &amp;os=cout)</td></tr><tr><td nowrap align=right valign=top>Time&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a10">operator+</a> (const int &amp;i)</td></tr><tr><td nowrap align=right valign=top>Time&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a11">operator+</a> (Time t)</td></tr><tr><td nowrap align=right valign=top>Time&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a12">operator-</a> (const int &amp;i)</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a13">operator-</a> (Time t)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a14">operator=</a> (const int &amp;i)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a15">operator+=</a> (Time t)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a16">operator+=</a> (const int &amp;i)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a17">operator-=</a> (Time t)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a18">operator-=</a> (const int &amp;i)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a19">operator!=</a> (Time t)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a20">operator!=</a> (const int &amp;i)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a21">operator==</a> (Time t)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a22">operator==</a> (const int &amp;i)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a23">operator&lt;</a> (Time t)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a24">operator&lt;</a> (const int &amp;i)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a25">operator&lt;=</a> (Time t)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a26">operator&lt;=</a> (const int &amp;i)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a27">operator&gt;</a> (Time t)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a28">operator&gt;</a> (const int &amp;i)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a29">operator&gt;=</a> (Time t)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#a30">operator&gt;=</a> (const int &amp;i)</td></tr><tr><td colspan=2><br><h2>Private Attributes</h2></td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#o0">m_iTime</a></td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#o1">m_iStopped</a></td></tr><tr><td colspan=2><br><h2>Friends</h2></td></tr><tr><td nowrap align=right valign=top>ostream &amp;&nbsp;</td><td valign=bottom><a class="el" href="classTime.html#l0">operator&lt;&lt;</a> (ostream &amp;os, Time t)</td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>This class contains the time representation of the soccer server. It is represented by an ordered pair (t,s) where t denotes the current server cycle and s is the number of cycles since the clock has stopped. Here the value for t equals that of the time stamp contained in the last message received from the server, whereas the value for $s$ will always be 0 while the game is in progress. It is only during certain dead ball situations (e.g. an offside call leading to a free kick) that this value will be different, since in these cases the server time will stop while cycles continue to pass (i.e. actions can still be performed). Representing the time in this way has the advantage that it allows the players to reason about the number of cycles between events in a meaningful way. <p><p>Definition at line <a class="el" href="SoccerTypes_8h-source.html#l00413">413</a> of file <a class="el" href="SoccerTypes_8h-source.html">SoccerTypes.h</a>.<hr><h2>Constructor &amp; Destructor Documentation</h2><a name="a0" doxytag="Time::Time"></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"> Time::Time </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">int&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>iTime</em> = -1, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>int&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>iStopped</em> = 0</td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This is the constructor for the Time class, it receives two arguments. The actual time and how long the time has stopped. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>iTime</em>&nbsp;</td><td>actual time </td></tr><tr><td valign=top><em>iStopped</em>&nbsp;</td><td>number of cycles time stopped </td></tr></table></dl><p>Definition at line <a class="el" href="SoccerTypes_8C-source.html#l00069">69</a> of file <a class="el" href="SoccerTypes_8C-source.html">SoccerTypes.C</a>.<p>References <a class="el" href="SoccerTypes_8h-source.html#l00416">m_iStopped</a>, and <a class="el" href="SoccerTypes_8h-source.html#l00415">m_iTime</a>.<p>Referenced by <a class="el" href="SoccerTypes_8C-source.html#l00154">getTimeAddedWith</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00298">operator!=</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00219">operator+</a>(), and <a class="el" href="SoccerTypes_8C-source.html#l00350">operator&lt;</a>().    </td>  </tr></table><hr><h2>Member Function Documentation</h2><a name="a8" doxytag="Time::addToTime"></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"> bool Time::addToTime </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">int&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>iCycles</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This method adds 'iCycles' to the current time. The current values are updated. The method getTimeAddedWith is used to calculated the new time. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>iCycles</em>&nbsp;</td><td>time added to the current time </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>boolean indicating whether update was successful </dl><p>Definition at line <a class="el" href="SoccerTypes_8C-source.html#l00188">188</a> of file <a class="el" href="SoccerTypes_8C-source.html">SoccerTypes.C</a>.<p>References <a class="el" href="SoccerTypes_8C-source.html#l00154">getTimeAddedWith</a>().<p>Referenced by <a class="el" href="SoccerTypes_8C-source.html#l00256">operator+=</a>(), and <a class="el" href="SoccerTypes_8C-source.html#l00276">operator-=</a>().    </td>  </tr></table><a name="a3" doxytag="Time::getTime"></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 Time::getTime </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This method returns the actual time, that is the number of cycles that have passed. <dl compact><dt><b>Returns: </b><dd>actual time. </dl><p>Definition at line <a class="el" href="SoccerTypes_8C-source.html#l00106">106</a> of file <a class="el" href="SoccerTypes_8C-source.html">SoccerTypes.C</a>.<p>References <a class="el" href="SoccerTypes_8h-source.html#l00415">m_iTime</a>.<p>Referenced by <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="Objects_8C-source.html#l00083">Object::getConfidence</a>(), <a class="el" href="WorldModel_8C-source.html#l00189">WorldModel::getCurrentCycle</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00154">getTimeAddedWith</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00125">getTimeDifference</a>(), <a class="el" href="WorldModel_8C-source.html#l00150">WorldModel::getTimeSinceLastCatch</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00219">operator+</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00266">operator+=</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00285">operator-=</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00423">operator&lt;&lt;</a>(), <a class="el" href="WorldModel_8C-source.html#l01150">WorldModel::show</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00198">show</a>(), <a class="el" href="WorldModel_8C-source.html#l01185">WorldModel::showObjects</a>(), <a class="el" href="WorldModelUpdate_8C-source.html#l00511">WorldModel::updateAfterSeeMessage</a>(), and <a class="el" href="WorldModelUpdate_8C-source.html#l00659">WorldModel::updateAgentAndBallAfterSense</a>().    </td>  </tr></table><a name="a7" doxytag="Time::getTimeAddedWith"></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"> Time Time::getTimeAddedWith </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">int&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>iCycles</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>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. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>iCycles</em>&nbsp;</td><td>denotes the time that should be added (when negative subtracted) to the current time </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>new time object with 'iCycles' added to the current time. 'iCycles' can be negative in which case a subtraction is performed. </dl><p>Definition at line <a class="el" href="SoccerTypes_8C-source.html#l00154">154</a> of file <a class="el" href="SoccerTypes_8C-source.html">SoccerTypes.C</a>.<p>References <a class="el" href="SoccerTypes_8C-source.html#l00106">getTime</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00114">getTimeStopped</a>(), and <a class="el" href="SoccerTypes_8C-source.html#l00069">Time</a>().<p>Referenced by <a class="el" href="SoccerTypes_8C-source.html#l00188">addToTime</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00208">operator+</a>(), and <a class="el" href="SoccerTypes_8C-source.html#l00229">operator-</a>().    </td>  </tr></table><a name="a5" doxytag="Time::getTimeDifference"></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 Time::getTimeDifference </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">Time&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>t</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This method returns the time difference between two time objects. When the time is stopped, but the actual time differens the value -1 is returned otherwise the difference in stopped time is returned. When the time is not stopped, the difference in the actual time is returned. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>t</em>&nbsp;</td><td>Time with which current time should be compared </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>time difference </dl><p>Definition at line <a class="el" href="SoccerTypes_8C-source.html#l00125">125</a> of file <a class="el" href="SoccerTypes_8C-source.html">SoccerTypes.C</a>.<p>References <a class="el" href="SoccerTypes_8C-source.html#l00106">getTime</a>(), and <a class="el" href="SoccerTypes_8C-source.html#l00114">getTimeStopped</a>().<p>Referenced by <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="Objects_8C-source.html#l00083">Object::getConfidence</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00298">operator!=</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00238">operator-</a>(), and <a class="el" href="SoccerTypes_8C-source.html#l00340">operator&lt;</a>().    </td>  </tr></table><a name="a4" doxytag="Time::getTimeStopped"></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 Time::getTimeStopped </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This method returns the time the time has stopped, that is the number of cycles the time stood on the current value. <dl compact><dt><b>Returns: </b><dd>stopped time </dl><p>Definition at line <a class="el" href="SoccerTypes_8C-source.html#l00114">114</a> of file <a class="el" href="SoccerTypes_8C-source.html">SoccerTypes.C</a>.<p>References <a class="el" href="SoccerTypes_8h-source.html#l00416">m_iStopped</a>.<p>Referenced by <a class="el" href="SoccerTypes_8C-source.html#l00154">getTimeAddedWith</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00125">getTimeDifference</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00219">operator+</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00266">operator+=</a>(), <a class="el" href="SoccerTypes_8C-source.html#l00423">operator&lt;&lt;</a>(), and <a class="el" href="SoccerTypes_8C-source.html#l00198">show</a>().    </td>  </tr></table><a name="a6" doxytag="Time::isStopped"></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"> bool Time::isStopped </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This method returns a boolean value indicating whether the time currently is stopped. <dl compact><dt><b>Returns: </b><dd>boolean indicating whether the time currently is stopped </dl><p>Definition at line <a class="el" href="SoccerTypes_8C-source.html#l00138">138</a> of file <a class="el" href="SoccerTypes_8C-source.html">SoccerTypes.C</a>.<p>References <a class="el" href="SoccerTypes_8h-source.html#l00416">m_iStopped</a>.<p>Referenced by <a class="el" href="WorldModel_8C-source.html#l00201">WorldModel::isTimeStopped</a>().    </td>  </tr></table><a name="a20" doxytag="Time::operator!="></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"> bool Time::operator!= </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const int &amp;&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>i</em>          </td>          <td class="md" valign="top">)&nbsp;</td>

⌨️ 快捷键说明

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