<!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>TimerPort class Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.10 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> <hr><h1>TimerPort Class Reference</h1>Timer ports are used to provide synchronized timing events when managed under a "service thread" such as <a class="el" href="class_socket_service.html">SocketService</a>. synchronized millisecond timing for service threads. <a href="#_details">More...</a> <p> <code>#include <<a class="el" href="thread_8h-source.html">thread.h</a>></code> <p> <p>Inheritance diagram for TimerPort:: <p><center><img src="class_timer_port.gif" usemap="#TimerPort_map" border="0"></center> <map name="TimerPort_map"> <area href="class_serial_port.html" alt="SerialPort" shape="rect" coords="0,56,73,80"> <area href="class_socket_port.html" alt="SocketPort" shape="rect" coords="83,56,156,80"> </map> <a href="class_timer_port-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> </td><td valign=bottom><a class="el" href="class_timer_port.html#a0">TimerPort</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>Create a timer, mark it as inactive, and set the initial "start" time to the creation time of the timer object.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="class_timer_port.html#a1">setTimer</a> (<a class="el" href="thread_8h.html#a10">timeout_t</a> timeout=0)</td></tr> <tr><td> </td><td><font size=-1><em>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.</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="class_timer_port.html#a2">incTimer</a> (<a class="el" href="thread_8h.html#a10">timeout_t</a> timeout)</td></tr> <tr><td> </td><td><font size=-1><em>Set a timeout based on the current time reference value either from object creation or the last <a class="el" href="class_timer_port.html#a1">setTimer</a>().</em> <a href="#a2">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="class_timer_port.html#a3">endTimer</a> (void)</td></tr> <tr><td> </td><td><font size=-1><em>This is used to "disable" the service thread from expiring the timer object.</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a class="el" href="thread_8h.html#a10">timeout_t</a> </td><td valign=bottom><a class="el" href="class_timer_port.html#a4">getTimer</a> (void)</td></tr> <tr><td> </td><td><font size=-1><em>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="class_timer_port.html#a1">setTimer</a>() or <a class="el" href="class_timer_port.html#a2">incTimer</a>().</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a class="el" href="thread_8h.html#a10">timeout_t</a> </td><td valign=bottom><a class="el" href="class_timer_port.html#a5">getElapsed</a> (void)</td></tr> <tr><td> </td><td><font size=-1><em>This is used to determine how much time has elapsed since a timer port setTimer benchmark time was initially set.</em> <a href="#a5">More...</a><em></em></font><br><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 <a class="el" href="class_socket_service.html">SocketService</a>. 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><dd> David Sugar <<a href="mailto:dyfet@ostel.com">dyfet@ostel.com</a>> </dl> <p> <hr><h2>Constructor & Destructor Documentation</h2> <a name="a0" doxytag="TimerPort::TimerPort"></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"> TimerPort::TimerPort </td> <td class="md">( </td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </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 name="a3" doxytag="TimerPort::endTimer"></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"> void TimerPort::endTimer </td> <td class="md">( </td> <td class="md">void</td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </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="class_timer_port.html#a1">setTimer</a>(). </td> </tr> </table> <a name="a5" doxytag="TimerPort::getElapsed"></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"> <a class="el" href="thread_8h.html#a10">timeout_t</a> TimerPort::getElapsed </td> <td class="md">( </td> <td class="md">void</td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </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="class_timer_port.html#a1">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 -1 if inactive. </td> </tr> </table> <a name="a4" doxytag="TimerPort::getTimer"></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"> <a class="el" href="thread_8h.html#a10">timeout_t</a> TimerPort::getTimer </td> <td class="md">( </td> <td class="md">void</td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </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="class_timer_port.html#a1">setTimer</a>() or <a class="el" href="class_timer_port.html#a2">incTimer</a>(). <p> It can also be called after setting a timeout with <a class="el" href="class_timer_port.html#a2">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 -1 if inactive. </td> </tr> </table> <a name="a2" doxytag="TimerPort::incTimer"></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"> void TimerPort::incTimer </td> <td class="md">( </td> <td class="md"><a class="el" href="thread_8h.html#a10">timeout_t</a></td> <td class="mdname1"> <em>timeout</em> </td> <td class="md">) </td> <td class="md"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Set a timeout based on the current time reference value either from object creation or the last <a class="el" href="class_timer_port.html#a1">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.<dl compact><dt><b> Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>timeout </em> </td><td> delay in milliseconds from reference. </td></tr> </table> </dl> <p> Reimplemented in <a class="el" href="class_serial_port.html#a1">SerialPort</a>, and <a class="el" href="class_socket_port.html#a1">SocketPort</a>. </td> </tr> </table> <a name="a1" doxytag="TimerPort::setTimer"></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"> void TimerPort::setTimer </td> <td class="md">( </td> <td class="md"><a class="el" href="thread_8h.html#a10">timeout_t</a></td> <td class="mdname1"> <em>timeout</em> = 0 </td> <td class="md">) </td> <td class="md"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </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.<dl compact><dt><b> Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>timeout </em> </td><td> delay in milliseconds from "now" </td></tr> </table> </dl> <p> Reimplemented in <a class="el" href="class_serial_port.html#a0">SerialPort</a>, and <a class="el" href="class_socket_port.html#a0">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><address><small>Generated at Tue Nov 20 13:28:51 2001 for CommonC++ 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.10 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2001</small></address> </body> </html>