📄 timer_8h-source.html
字号:
00121 <span class="preprocessor">#ifdef P_USE_PRAGMA</span>00122 <span class="preprocessor"></span><span class="preprocessor">#pragma interface</span>00123 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00124 <span class="preprocessor"></span>00125 <span class="keyword">class </span><a class="code" href="classPThread.html">PThread</a>;00126 00127 <span class="preprocessor">#include <<a class="code" href="notifier_8h.html">ptlib/notifier.h</a>></span>00128 <a name="l00157"></a><a class="code" href="classPTimer.html">00157</a> <span class="keyword">class </span><a class="code" href="classPTimer.html">PTimer</a> : <span class="keyword">public</span> <a class="code" href="classPTimeInterval.html">PTimeInterval</a>00158 {00159 <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(<a class="code" href="classPTimer.html">PTimer</a>, <a class="code" href="classPTimeInterval.html">PTimeInterval</a>);00160 00161 <span class="keyword">public</span>:00169 <a class="code" href="classPTimer.html#z457_0">PTimer</a>(00170 <span class="keywordtype">long</span> <a class="code" href="classPTimeInterval.html#n0">milliseconds</a> = 0, 00171 <span class="keywordtype">int</span> seconds = 0, 00172 <span class="keywordtype">int</span> minutes = 0, 00173 <span class="keywordtype">int</span> hours = 0, 00174 <span class="keywordtype">int</span> days = 0 00175 );00176 <a class="code" href="classPTimer.html#z457_0">PTimer</a>(00177 <span class="keyword">const</span> <a class="code" href="classPTimeInterval.html">PTimeInterval</a> & time 00178 );00179 00186 <a class="code" href="classPTimer.html">PTimer</a> & <a class="code" href="classPTimer.html#z457_2">operator=</a>(00187 DWORD <a class="code" href="classPTimeInterval.html#n0">milliseconds</a> 00188 );00189 <a class="code" href="classPTimer.html">PTimer</a> & <a class="code" href="classPTimer.html#z457_2">operator=</a>(00190 <span class="keyword">const</span> <a class="code" href="classPTimeInterval.html">PTimeInterval</a> & time 00191 );00192 00196 <span class="keyword">virtual</span> <a class="code" href="classPTimer.html#z457_4">~PTimer</a>();00198 00212 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPTimer.html#z459_0">SetInterval</a>(00213 PInt64 <a class="code" href="classPTimeInterval.html#n0">milliseconds</a> = 0, 00214 <span class="keywordtype">long</span> seconds = 0, 00215 <span class="keywordtype">long</span> minutes = 0, 00216 <span class="keywordtype">long</span> hours = 0, 00217 <span class="keywordtype">int</span> days = 0 00218 );00219 00224 <span class="keywordtype">void</span> <a class="code" href="classPTimer.html#z459_1">RunContinuous</a>(00225 <span class="keyword">const</span> <a class="code" href="classPTimeInterval.html">PTimeInterval</a> & time <span class="comment">// New time interval for timer.</span>00226 );00227 00232 <span class="keywordtype">void</span> <a class="code" href="classPTimer.html#z459_2">Stop</a>();00233 00240 BOOL <a class="code" href="classPTimer.html#z459_3">IsRunning</a>() <span class="keyword">const</span>;00241 00246 <span class="keywordtype">void</span> <a class="code" href="classPTimer.html#z459_4">Pause</a>();00247 00252 <span class="keywordtype">void</span> <a class="code" href="classPTimer.html#z459_5">Resume</a>();00253 00259 BOOL <a class="code" href="classPTimer.html#z459_6">IsPaused</a>() <span class="keyword">const</span>;00260 00263 <span class="keywordtype">void</span> <a class="code" href="classPTimer.html#z459_7">Reset</a>();00264 00267 <span class="keyword">const</span> <a class="code" href="classPTimeInterval.html">PTimeInterval</a> & <a class="code" href="classPTimer.html#z459_8">GetResetTime</a>() <span class="keyword">const</span>;00269 00284 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPTimer.html#z461_0">OnTimeout</a>();00285 00292 <span class="keyword">const</span> <a class="code" href="classPNotifier.html">PNotifier</a> & <a class="code" href="classPTimer.html#z461_1">GetNotifier</a>() <span class="keyword">const</span>;00293 00297 <span class="keywordtype">void</span> <a class="code" href="classPTimer.html#z461_2">SetNotifier</a>(00298 <span class="keyword">const</span> <a class="code" href="classPNotifier.html">PNotifier</a> & func <span class="comment">// New notifier function for the timer.</span>00299 );00301 00316 <span class="keyword">static</span> <a class="code" href="classPTimeInterval.html">PTimeInterval</a> <a class="code" href="classPTimer.html#z463_0">Tick</a>();00317 00326 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <a class="code" href="classPTimer.html#z463_1">Resolution</a>();00328 00329 <span class="keyword">private</span>:00330 <span class="keywordtype">void</span> Construct();00331 00332 <span class="comment">/* Start or restart the timer from the #resetTime# variable.</span>00333 <span class="comment"> This is an internal function.</span>00334 <span class="comment"> */</span>00335 <span class="keywordtype">void</span> StartRunning(00336 BOOL once <span class="comment">// Flag for one shot or continuous.</span>00337 );00338 00339 <span class="comment">/* Process the timer decrementing it by the delta amount and calling the</span>00340 <span class="comment"> #OnTimeout()# when zero. This is used internally by the</span>00341 <span class="comment"> #PTimerList::Process()# function.</span>00342 <span class="comment"> */</span>00343 <span class="keywordtype">void</span> Process(00344 <span class="keyword">const</span> <a class="code" href="classPTimeInterval.html">PTimeInterval</a> & delta, <span class="comment">// Time interval since last call.</span>00345 <a class="code" href="classPTimeInterval.html">PTimeInterval</a> & minTimeLeft <span class="comment">// Minimum time left till next timeout.</span>00346 );00347 00348 <span class="comment">// Member variables</span>00349 <a class="code" href="classPNotifier.html">PNotifier</a> callback;00350 <span class="comment">// Callback function for expired timers.</span>00351 00352 <a class="code" href="classPTimeInterval.html">PTimeInterval</a> resetTime;00353 <span class="comment">// The time to reset a timer to when RunContinuous() is called.</span>00354 00355 BOOL oneshot;00356 <span class="comment">// Timer operates once then stops.</span>00357 00358 <span class="keyword">enum</span> { Stopped, Starting, Running, Paused } state;00359 <span class="comment">// Timer state.</span>00360 00361 <a name="l00362"></a><a class="code" href="classPTimer.html#l0">00362</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classPTimerList.html">PTimerList</a>;00363 <a class="code" href="classPTimerList.html">PTimerList</a> * timerList;00364 00365 00366 <span class="comment">// Include platform dependent part of class</span>00367 <span class="preprocessor">#ifdef _WIN32</span>00368 <span class="preprocessor"></span><span class="preprocessor">#include "msos/ptlib/timer.h"</span>00369 <span class="preprocessor">#else</span>00370 <span class="preprocessor"></span><span class="preprocessor">#include "unix/ptlib/timer.h"</span>00371 <span class="preprocessor">#endif</span>00372 <span class="preprocessor"></span>};00373 00374 <span class="preprocessor">#endif</span>00375 <span class="preprocessor"></span>00376 00377 <span class="comment">// End Of File ///////////////////////////////////////////////////////////////</span></pre></div><hr><address style="align: right;"><small>Generated on Wed Sep 29 22:44:12 2004 for PWLib by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -