Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > by-pkgid > ad1ba1135a9c9eeffc2e538163e00373 > files > 348

libCommonC++2_1.4-devel-1.4.1-1mdv2007.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>GNU CommonC++: ost::TimerPort Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.6 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="namespaces.html"><span>Namespaces</span></a></li>
    <li id="current"><a href="classes.html"><span>Classes</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
    <li><a href="examples.html"><span>Examples</span></a></li>
  </ul></div>
<div class="tabs">
  <ul>
    <li><a href="classes.html"><span>Alphabetical&nbsp;List</span></a></li>
    <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
    <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
    <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
  </ul></div>
<div class="nav">
<a class="el" href="namespaceost.html">ost</a>::<a class="el" href="classost_1_1_timer_port.html">TimerPort</a></div>
<h1>ost::TimerPort Class Reference</h1><!-- doxytag: class="ost::TimerPort" -->Timer ports are used to provide synchronized timing events when managed under a "service thread" such as SocketService.synchronized millisecond timing for service threads.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="thread_8h-source.html">thread.h</a>&gt;</code>
<p>
<p>Inheritance diagram for ost::TimerPort:
<p><center><img src="classost_1_1_timer_port.png" usemap="#ost::TimerPort_map" border="0" alt=""></center>
<map name="ost::TimerPort_map">
<area href="classost_1_1_serial_port.html" alt="ost::SerialPort" shape="rect" coords="0,56,95,80">
<area href="classost_1_1_socket_port.html" alt="ost::SocketPort" shape="rect" coords="105,56,200,80">
</map>
<a href="classost_1_1_timer_port-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_timer_port.html#d9ecc3aa1d6c62ac2e54e3e725d0c2c2">TimerPort</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a timer, mark it as inactive, and set the initial "start" time to the creation time of the timer object.  <a href="#d9ecc3aa1d6c62ac2e54e3e725d0c2c2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_timer_port.html#32b59a072fe60d94251a53579b3ca17f">setTimer</a> (<a class="el" href="thread_8h.html#f412159e5cef839836a5e7b19ee75d1c">timeout_t</a> timeout=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set a new start time for the object based on when this call is made and optionally activate the timer for a specified number of milliseconds.  <a href="#32b59a072fe60d94251a53579b3ca17f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_timer_port.html#b2c732120c3bb09e8d38a87b7443906d">incTimer</a> (<a class="el" href="thread_8h.html#f412159e5cef839836a5e7b19ee75d1c">timeout_t</a> timeout)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set a timeout based on the current time reference value either from object creation or the last <a class="el" href="classost_1_1_timer_port.html#32b59a072fe60d94251a53579b3ca17f">setTimer()</a>.  <a href="#b2c732120c3bb09e8d38a87b7443906d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_timer_port.html#9f473745a237d71219096c9a5b440445">endTimer</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This is used to "disable" the service thread from expiring the timer object.  <a href="#9f473745a237d71219096c9a5b440445"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="thread_8h.html#f412159e5cef839836a5e7b19ee75d1c">timeout_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_timer_port.html#7c8c5396ab12d69dd9048e88b0cb125c">getTimer</a> (void) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This is used by service threads to determine how much time remains before the timer expires based on a timeout specified in <a class="el" href="classost_1_1_timer_port.html#32b59a072fe60d94251a53579b3ca17f">setTimer()</a> or <a class="el" href="classost_1_1_timer_port.html#b2c732120c3bb09e8d38a87b7443906d">incTimer()</a>.  <a href="#7c8c5396ab12d69dd9048e88b0cb125c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="thread_8h.html#f412159e5cef839836a5e7b19ee75d1c">timeout_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_timer_port.html#c46e765c47dafaac921ed00b40b92018">getElapsed</a> (void) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This is used to determine how much time has elapsed since a timer port setTimer benchmark time was initially set.  <a href="#c46e765c47dafaac921ed00b40b92018"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Timer ports are used to provide synchronized timing events when managed under a "service thread" such as SocketService.synchronized millisecond timing for service threads. 
<p>
This is made into a stand-alone base class since other derived libraries (such as the serial handlers) may also use the pooled "service thread" model and hence also require this code for managing timing.<p>
<dl compact><dt><b>Author:</b></dt><dd>David Sugar &lt;<a href="mailto:dyfet@ostel.com">dyfet@ostel.com</a>&gt; </dd></dl>

<p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="d9ecc3aa1d6c62ac2e54e3e725d0c2c2"></a><!-- doxytag: member="ost::TimerPort::TimerPort" ref="d9ecc3aa1d6c62ac2e54e3e725d0c2c2" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">ost::TimerPort::TimerPort           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&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>
Create a timer, mark it as inactive, and set the initial "start" time to the creation time of the timer object. 
<p>
This allows "incTimer" to initially refer to time delays relative to the original start time of the object.     </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="9f473745a237d71219096c9a5b440445"></a><!-- doxytag: member="ost::TimerPort::endTimer" ref="9f473745a237d71219096c9a5b440445" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void ost::TimerPort::endTimer           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&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 is used to "disable" the service thread from expiring the timer object. 
<p>
It does not effect the reference time from either creation or a <a class="el" href="classost_1_1_timer_port.html#32b59a072fe60d94251a53579b3ca17f">setTimer()</a>.     </td>
  </tr>
</table>
<a class="anchor" name="c46e765c47dafaac921ed00b40b92018"></a><!-- doxytag: member="ost::TimerPort::getElapsed" ref="c46e765c47dafaac921ed00b40b92018" args="(void) const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="thread_8h.html#f412159e5cef839836a5e7b19ee75d1c">timeout_t</a> ost::TimerPort::getElapsed           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
This is used to determine how much time has elapsed since a timer port setTimer benchmark time was initially set. 
<p>
This allows one to use <a class="el" href="classost_1_1_timer_port.html#32b59a072fe60d94251a53579b3ca17f">setTimer()</a> to set the timer to the current time and then measure elapsed time from that point forward.<p>
return time elapsed in milliseconds, or TIMEOUT_INF if inactive.     </td>
  </tr>
</table>
<a class="anchor" name="7c8c5396ab12d69dd9048e88b0cb125c"></a><!-- doxytag: member="ost::TimerPort::getTimer" ref="7c8c5396ab12d69dd9048e88b0cb125c" args="(void) const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="thread_8h.html#f412159e5cef839836a5e7b19ee75d1c">timeout_t</a> ost::TimerPort::getTimer           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
This is used by service threads to determine how much time remains before the timer expires based on a timeout specified in <a class="el" href="classost_1_1_timer_port.html#32b59a072fe60d94251a53579b3ca17f">setTimer()</a> or <a class="el" href="classost_1_1_timer_port.html#b2c732120c3bb09e8d38a87b7443906d">incTimer()</a>. 
<p>
It can also be called after setting a timeout with <a class="el" href="classost_1_1_timer_port.html#b2c732120c3bb09e8d38a87b7443906d">incTimer()</a> to see if the current timeout has already expired and hence that the application is already delayed and should skip frame(s).<p>
return time remaining in milliseconds, or TIMEOUT_INF if inactive.     </td>
  </tr>
</table>
<a class="anchor" name="b2c732120c3bb09e8d38a87b7443906d"></a><!-- doxytag: member="ost::TimerPort::incTimer" ref="b2c732120c3bb09e8d38a87b7443906d" args="(timeout_t timeout)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void ost::TimerPort::incTimer           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="thread_8h.html#f412159e5cef839836a5e7b19ee75d1c">timeout_t</a>&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>timeout</em>          </td>
          <td class="md" valign="top">&nbsp;)&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>
Set a timeout based on the current time reference value either from object creation or the last <a class="el" href="classost_1_1_timer_port.html#32b59a072fe60d94251a53579b3ca17f">setTimer()</a>. 
<p>
This reference can be used to time synchronize realtime data over specified intervals and force expiration when a new frame should be released in a synchronized manner.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>timeout</em>&nbsp;</td><td>delay in milliseconds from reference. </td></tr>
  </table>
</dl>

<p>
Reimplemented in <a class="el" href="classost_1_1_serial_port.html#4fa45b7494efbcd0c1b28a724f93b6b3">ost::SerialPort</a>, and <a class="el" href="classost_1_1_socket_port.html#1a7e2bf9e250ea5dcc9e8416aecfbb13">ost::SocketPort</a>.    </td>
  </tr>
</table>
<a class="anchor" name="32b59a072fe60d94251a53579b3ca17f"></a><!-- doxytag: member="ost::TimerPort::setTimer" ref="32b59a072fe60d94251a53579b3ca17f" args="(timeout_t timeout=0)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void ost::TimerPort::setTimer           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="thread_8h.html#f412159e5cef839836a5e7b19ee75d1c">timeout_t</a>&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>timeout</em> = <code>0</code>          </td>
          <td class="md" valign="top">&nbsp;)&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>
Set a new start time for the object based on when this call is made and optionally activate the timer for a specified number of milliseconds. 
<p>
This can be used to set the starting time of a realtime session.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>timeout</em>&nbsp;</td><td>delay in milliseconds from "now" </td></tr>
  </table>
</dl>

<p>
Reimplemented in <a class="el" href="classost_1_1_serial_port.html#eb008981e1a1d2eff230b231c3ce5d9c">ost::SerialPort</a>, and <a class="el" href="classost_1_1_socket_port.html#c70f9eae6b6b3625c980fa84180e8151">ost::SocketPort</a>.    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="thread_8h-source.html">thread.h</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Mon Jun 19 10:50:57 2006 for GNU CommonC++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address>
</body>
</html>