.TH "ost::TimerPort" 3 "Sun Dec 27 2020" "GNU CommonC++" \" -*- nroff -*- .ad l .nh .SH NAME ost::TimerPort \- Timer ports are used to provide synchronized timing events when managed under a 'service thread' such as \fBSocketService\fP\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherited by \fBost::SerialPort\fP, and \fBost::SocketPort\fP\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBTimerPort\fP ()" .br .RI "Create a timer, mark it as inactive, and set the initial 'start' time to the creation time of the timer object\&. " .ti -1c .RI "void \fBsetTimer\fP (\fBtimeout_t\fP timeout=0)" .br .RI "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\&. " .ti -1c .RI "void \fBincTimer\fP (\fBtimeout_t\fP timeout)" .br .RI "Set a timeout based on the current time reference value either from object creation or the last \fBsetTimer()\fP\&. " .ti -1c .RI "void \fBdecTimer\fP (\fBtimeout_t\fP timeout)" .br .RI "Adjust a timeout based on the current time reference value either from object creation or the last \fBsetTimer()\fP\&. " .ti -1c .RI "void \fBsleepTimer\fP (void)" .br .RI "Sleep until the current timer expires\&. " .ti -1c .RI "void \fBendTimer\fP (void)" .br .RI "This is used to 'disable' the service thread from expiring the timer object\&. " .ti -1c .RI "\fBtimeout_t\fP \fBgetTimer\fP (void) const" .br .RI "This is used by service threads to determine how much time remains before the timer expires based on a timeout specified in \fBsetTimer()\fP or \fBincTimer()\fP\&. " .ti -1c .RI "\fBtimeout_t\fP \fBgetElapsed\fP (void) const" .br .RI "This is used to determine how much time has elapsed since a timer port setTimer benchmark time was initially set\&. " .in -1c .SH "Detailed Description" .PP Timer ports are used to provide synchronized timing events when managed under a 'service thread' such as \fBSocketService\fP\&. 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\&. .PP \fBAuthor\fP .RS 4 David Sugar dyfet@ostel.com .RE .PP synchronized millisecond timing for service threads\&. .SH "Constructor & Destructor Documentation" .PP .SS "ost::TimerPort::TimerPort ()" .PP Create a timer, mark it as inactive, and set the initial 'start' time to the creation time of the timer object\&. This allows 'incTimer' to initially refer to time delays relative to the original start time of the object\&. .SH "Member Function Documentation" .PP .SS "void ost::TimerPort::decTimer (\fBtimeout_t\fP timeout)" .PP Adjust a timeout based on the current time reference value either from object creation or the last \fBsetTimer()\fP\&. 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\&. .PP \fBParameters\fP .RS 4 \fItimeout\fP delay in milliseconds from reference\&. .RE .PP .SS "void ost::TimerPort::endTimer (void)" .PP This is used to 'disable' the service thread from expiring the timer object\&. It does not effect the reference time from either creation or a \fBsetTimer()\fP\&. .SS "\fBtimeout_t\fP ost::TimerPort::getElapsed (void) const" .PP This is used to determine how much time has elapsed since a timer port setTimer benchmark time was initially set\&. This allows one to use \fBsetTimer()\fP to set the timer to the current time and then measure elapsed time from that point forward\&. .PP return time elapsed in milliseconds, or TIMEOUT_INF if inactive\&. .SS "\fBtimeout_t\fP ost::TimerPort::getTimer (void) const" .PP This is used by service threads to determine how much time remains before the timer expires based on a timeout specified in \fBsetTimer()\fP or \fBincTimer()\fP\&. It can also be called after setting a timeout with \fBincTimer()\fP to see if the current timeout has already expired and hence that the application is already delayed and should skip frame(s)\&. .PP return time remaining in milliseconds, or TIMEOUT_INF if inactive\&. .SS "void ost::TimerPort::incTimer (\fBtimeout_t\fP timeout)" .PP Set a timeout based on the current time reference value either from object creation or the last \fBsetTimer()\fP\&. 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\&. .PP \fBParameters\fP .RS 4 \fItimeout\fP delay in milliseconds from reference\&. .RE .PP .SS "void ost::TimerPort::setTimer (\fBtimeout_t\fP timeout = \fC0\fP)" .PP 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\&. This can be used to set the starting time of a realtime session\&. .PP \fBParameters\fP .RS 4 \fItimeout\fP delay in milliseconds from 'now' .RE .PP .SS "void ost::TimerPort::sleepTimer (void)" .PP Sleep until the current timer expires\&. This is useful in time syncing realtime periodic tasks\&. .SH "Author" .PP Generated automatically by Doxygen for GNU CommonC++ from the source code\&.