File: TimerPort.3cc

package info (click to toggle)
libcommoncpp2 1.0.13-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,740 kB
  • ctags: 2,860
  • sloc: cpp: 18,857; sh: 8,451; ansic: 1,546; makefile: 299; xml: 5
file content (108 lines) | stat: -rw-r--r-- 4,478 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
.TH "TimerPort" 3 "19 Jul 2003" "CommonC++" \" -*- nroff -*-
.ad l
.nh
.SH NAME
TimerPort \- Timer ports are used to provide synchronized timing events when managed under a 'service thread' such as \fBSocketService\fP. synchronized millisecond timing for service threads. 
.SH SYNOPSIS
.br
.PP
\fC#include <thread.h>\fP
.PP
Inherited by \fBSerialPort\fP, and \fBSocketPort\fP.
.PP
.SS "Public Methods"

.in +1c
.ti -1c
.RI "\fBTimerPort\fP ()"
.br
.RI "\fICreate a timer, mark it as inactive, and set the initial 'start' time to the creation time of the timer object.\fP"
.ti -1c
.RI "void \fBsetTimer\fP (\fBtimeout_t\fP timeout=0)"
.br
.RI "\fISet 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.\fP"
.ti -1c
.RI "void \fBincTimer\fP (\fBtimeout_t\fP timeout)"
.br
.RI "\fISet a timeout based on the current time reference value either from object creation or the last \fBsetTimer()\fP.\fP"
.ti -1c
.RI "void \fBendTimer\fP (void)"
.br
.RI "\fIThis is used to 'disable' the service thread from expiring the timer object.\fP"
.ti -1c
.RI "\fBtimeout_t\fP \fBgetTimer\fP (void) const"
.br
.RI "\fIThis 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.\fP"
.ti -1c
.RI "\fBtimeout_t\fP \fBgetElapsed\fP (void) const"
.br
.RI "\fIThis is used to determine how much time has elapsed since a timer port setTimer benchmark time was initially set.\fP"
.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. synchronized millisecond timing for service threads.
.PP
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
.in +1c
David Sugar <dyfet@ostel.com> 
.PP
.SH "CONSTRUCTOR & DESTRUCTOR DOCUMENTATION"
.PP 
.SS "TimerPort::TimerPort ()"
.PP
Create a timer, mark it as inactive, and set the initial 'start' time to the creation time of the timer object.
.PP
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 TimerPort::endTimer (void)"
.PP
This is used to 'disable' the service thread from expiring the timer object.
.PP
It does not effect the reference time from either creation or a \fBsetTimer()\fP. 
.SS "\fBtimeout_t\fP 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.
.PP
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 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.
.PP
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 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.
.PP
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
.in +1c
.TP
\fB\fItimeout\fP\fP
delay in milliseconds from reference. 
.PP
Reimplemented in \fBSerialPort\fP, and \fBSocketPort\fP.
.SS "void TimerPort::setTimer (\fBtimeout_t\fP timeout = 0)"
.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.
.PP
This can be used to set the starting time of a realtime session.
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fItimeout\fP\fP
delay in milliseconds from 'now' 
.PP
Reimplemented in \fBSerialPort\fP, and \fBSocketPort\fP.

.SH "AUTHOR"
.PP 
Generated automatically by Doxygen for CommonC++ from the source code.