FTIMER.H 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: /CounterStrike/FTIMER.H 1 3/03/97 10:24a Joe_bostic $ */
  15. /***********************************************************************************************
  16. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : FTIMER.H *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : 03/16/95 *
  26. * *
  27. * Last Update : July 6, 1996 [JLB] *
  28. * *
  29. * *
  30. *---------------------------------------------------------------------------------------------*
  31. * Functions: *
  32. * BasicTimerClass<T>::BasicTimerClass -- Constructor for basic timer class. *
  33. * BasicTimerClass<T>::operator () -- Function operator for timer object. *
  34. * BasicTimerClass<T>::operator long -- Conversion to long operator. *
  35. * BasicTimerClass<T>::~BasicTimerClass -- Destructor for basic timer object. *
  36. * TTimerClass<T>::Is_Active -- Checks to see if the timer is counting. *
  37. * TTimerClass<T>::Start -- Starts (resumes) a stopped timer. *
  38. * TTimerClass<T>::Stop -- Stops the current timer from incrementing. *
  39. * TTimerClass<T>::TTimerClass -- Constructor for timer class object. *
  40. * TTimerClass<T>::operator () -- Function operator for timer object. *
  41. * TTimerClass<T>::operator long -- Conversion operator for timer object. *
  42. * CDTimerClass<T>::CDTimerClass -- Constructor for count down timer. *
  43. * CDTimerClass<T>::Is_Active -- Checks to see if the timer object is active. *
  44. * CDTimerClass<T>::Start -- Starts (resumes) the count down timer. *
  45. * CDTimerClass<T>::Stop -- Stops (pauses) the count down timer. *
  46. * CDTimerClass<T>::operator () -- Function operator for the count down timer. *
  47. * CDTimerClass<T>::operator long -- Conversion to long operator function. *
  48. * CDTimerClass<T>::~CDTimerClass -- Destructor for the count down timer object. *
  49. * TTimerClass<T>::Value -- Returns with the current value of the timer. *
  50. * CDTimerClass<T>::Value -- Fetches the current value of the countdown timer. *
  51. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  52. #ifndef FTIMER_H
  53. #define FTIMER_H
  54. /*
  55. ** The "bool" integral type was defined by the C++ committee in
  56. ** November of '94. Until the compiler supports this, use the following
  57. ** definition.
  58. */
  59. #ifndef __BORLANDC__
  60. #ifndef TRUE_FALSE_DEFINED
  61. #define TRUE_FALSE_DEFINED
  62. enum {false=0,true=1};
  63. typedef int bool;
  64. #endif
  65. #endif
  66. /**********************************************************************
  67. ** This class is solely used as a parameter to a constructor that does
  68. ** absolutely no initialization to the object being constructed. By using
  69. ** this method, it is possible to load and save data directly from a
  70. ** class that has virtual functions. The construction process automatically
  71. ** takes care of initializing the virtual function table pointer and the
  72. ** rest of the constructor doesn't initialize any data members. After loading
  73. ** into a class object, simply perform an in-place new operation.
  74. */
  75. #ifndef NOINITCLASS
  76. #define NOINITCLASS
  77. struct NoInitClass {
  78. public:
  79. void operator () (void) const {};
  80. };
  81. #endif
  82. /*
  83. ** This is a timer class that watches a constant rate timer (specified by the parameter
  84. ** type class) and provides basic timer functionality. It is possible to set the start value
  85. ** WITHOUT damaging or otherwise affecting any other timer that may be built upon the same
  86. ** specified timer class object. Treat an object of this type as if it were a "magic" integral
  87. ** long that automatically advances at the speed of the timer class object controlling it.
  88. */
  89. // Let lint know that non-virtual destructor is OK for this class.
  90. //lint -esym(1509,BasicTimerClass)
  91. template<class T>
  92. class BasicTimerClass {
  93. public:
  94. // Constructor allows assignment as if class was integral 'long' type.
  95. BasicTimerClass(unsigned long set=0);
  96. BasicTimerClass(NoInitClass const & );
  97. ~BasicTimerClass(void);
  98. // Fetch current value of timer.
  99. unsigned long Value(void) const;
  100. // Conversion operator to allow consistent treatment with integral types.
  101. operator unsigned long(void) const;
  102. // Function operator to allow timer object definition to be cascaded.
  103. unsigned long operator () (void) const;
  104. protected:
  105. T Timer; // Timer regulator (ticks at constant rate).
  106. unsigned long Started; // Time started.
  107. };
  108. template<class T>
  109. inline BasicTimerClass<T>::BasicTimerClass(NoInitClass const & )
  110. {
  111. }
  112. /***********************************************************************************************
  113. * BasicTimerClass<T>::BasicTimerClass -- Constructor for basic timer class. *
  114. * *
  115. * This is the constructor for the basic timer class object. It sets the timer counting *
  116. * up from zero at the rate of the controlling timer class object. *
  117. * *
  118. * INPUT: set -- Alternate initial start value for the counter. If not specified, then *
  119. * the timer is assumed to start at zero and count upwards. *
  120. * *
  121. * OUTPUT: none *
  122. * *
  123. * WARNINGS: none *
  124. * *
  125. * HISTORY: *
  126. * 02/05/1996 JLB : Created. *
  127. *=============================================================================================*/
  128. //lint -esym(1403,BasicTimerClass<class FrameTimerClass>::Timer)
  129. //lint -esym(1403,BasicTimerClass<class SystemTimerClass>::Timer)
  130. template<class T>
  131. inline BasicTimerClass<T>::BasicTimerClass(unsigned long set) :
  132. Started(Timer()-set)
  133. {
  134. }
  135. /***********************************************************************************************
  136. * BasicTimerClass<T>::~BasicTimerClass -- Destructor for basic timer object. *
  137. * *
  138. * The destructor for the basic timer object doesn't have to do anything. *
  139. * *
  140. * INPUT: none *
  141. * *
  142. * OUTPUT: none *
  143. * *
  144. * WARNINGS: none *
  145. * *
  146. * HISTORY: *
  147. * 02/05/1996 JLB : Created. *
  148. *=============================================================================================*/
  149. template<class T>
  150. inline BasicTimerClass<T>::~BasicTimerClass(void)
  151. {
  152. }
  153. template<class T>
  154. inline unsigned long BasicTimerClass<T>::Value(void) const
  155. {
  156. return(Timer()-Started);
  157. }
  158. /***********************************************************************************************
  159. * BasicTimerClass<T>::operator long -- Conversion to long operator. *
  160. * *
  161. * This conversion operator allows the basic timer object to function in much the same *
  162. * manner as the integral "long" type. One can assign a long with a timer object and the *
  163. * actual value of the timer is extracted from the object and used. *
  164. * *
  165. * INPUT: none *
  166. * *
  167. * OUTPUT: Returns with the timer value expressed as a long. *
  168. * *
  169. * WARNINGS: none *
  170. * *
  171. * HISTORY: *
  172. * 02/05/1996 JLB : Created. *
  173. *=============================================================================================*/
  174. template<class T>
  175. inline BasicTimerClass<T>::operator unsigned long(void) const
  176. {
  177. return(Timer()-Started);
  178. }
  179. /***********************************************************************************************
  180. * BasicTimerClass<T>::operator () -- Function operator for timer object. *
  181. * *
  182. * This function operator allows the timer to also serve as the parameter type class for *
  183. * additional timer objects. This allows one to instantiate a controlling timer class that *
  184. * can control (e.g., turn on or off) all timers that are based upon it. *
  185. * *
  186. * INPUT: none *
  187. * *
  188. * OUTPUT: Returns the current timer value expressed as a long. *
  189. * *
  190. * WARNINGS: none *
  191. * *
  192. * HISTORY: *
  193. * 02/05/1996 JLB : Created. *
  194. *=============================================================================================*/
  195. template<class T>
  196. inline unsigned long BasicTimerClass<T>::operator () (void) const
  197. {
  198. return(Timer()-Started);
  199. }
  200. /*
  201. ** This timer class functions similarly to the basic timer class. In addition to the
  202. ** normal timer operation, this class has the ability to be stopped and started at
  203. ** will. If you have no need to start or stop the timer, then use the basic timer
  204. ** class instead.
  205. */
  206. template<class T>
  207. class TTimerClass : public BasicTimerClass<T> {
  208. public:
  209. // Constructor allows assignment as if class was integral 'long' type.
  210. TTimerClass(unsigned long set=0);
  211. TTimerClass(NoInitClass const & x);
  212. ~TTimerClass(void) {};
  213. // Fetches current value of timer.
  214. unsigned long Value(void) const;
  215. // Conversion operator to allow consistent treatment with integral types.
  216. operator unsigned long(void) const;
  217. // Function operator to allow timer object definition to be cascaded.
  218. unsigned long operator () (void) const;
  219. // Stops (pauses) the timer.
  220. void Stop(void);
  221. // Starts (resumes) the timer.
  222. void Start(void);
  223. // Queries whether the timer is currently active.
  224. bool Is_Active(void) const;
  225. private:
  226. unsigned long Accumulated; // Total accumulated ticks.
  227. };
  228. template<class T>
  229. inline TTimerClass<T>::TTimerClass(NoInitClass const & x) :
  230. BasicTimerClass<T>(x)
  231. {
  232. }
  233. /***********************************************************************************************
  234. * TTimerClass<T>::TTimerClass -- Constructor for timer class object. *
  235. * *
  236. * This is the constructor for the advanced timer class object. This object class can start *
  237. * or stop the timer under user control. *
  238. * *
  239. * INPUT: set -- The initial value to set the timer to. If no value is specified, then *
  240. * the timer is assumed to start from zero. *
  241. * *
  242. * OUTPUT: none *
  243. * *
  244. * WARNINGS: none *
  245. * *
  246. * HISTORY: *
  247. * 02/05/1996 JLB : Created. *
  248. *=============================================================================================*/
  249. template<class T>
  250. inline TTimerClass<T>::TTimerClass(unsigned long set) :
  251. BasicTimerClass<T>(set),
  252. Accumulated(0)
  253. {
  254. }
  255. /***********************************************************************************************
  256. * TTimerClass<T>::Value -- Returns with the current value of the timer. *
  257. * *
  258. * This routine will return with the current value of the timer. It takes into account *
  259. * whether the timer has stopped or not so as to always return the correct value regardless *
  260. * of that condition. *
  261. * *
  262. * INPUT: none *
  263. * *
  264. * OUTPUT: Returns with the current value of the timer. *
  265. * *
  266. * WARNINGS: none *
  267. * *
  268. * HISTORY: *
  269. * 07/06/1996 JLB : Created. *
  270. *=============================================================================================*/
  271. template<class T>
  272. inline unsigned long TTimerClass<T>::Value(void) const
  273. {
  274. unsigned long value = Accumulated;
  275. if (Started != 0xFFFFFFFFU) {
  276. value += BasicTimerClass<T>::Value();
  277. }
  278. return(value);
  279. }
  280. /***********************************************************************************************
  281. * TTimerClass<T>::operator long -- Conversion operator for timer object. *
  282. * *
  283. * This conversion operator allows this timer object to function as an "rvalue" of a "long" *
  284. * type. This is consistent with the integral "long" value. It is possible to assign a *
  285. * timer object to a long and have the long initialized with the current value of the *
  286. * timer. *
  287. * *
  288. * INPUT: none *
  289. * *
  290. * OUTPUT: Returns with the current time value expressed as a long. *
  291. * *
  292. * WARNINGS: none *
  293. * *
  294. * HISTORY: *
  295. * 02/05/1996 JLB : Created. *
  296. *=============================================================================================*/
  297. template<class T>
  298. inline TTimerClass<T>::operator unsigned long(void) const
  299. {
  300. unsigned long value = Accumulated;
  301. if (Started != 0xFFFFFFFFU) {
  302. value += BasicTimerClass<T>::Value();
  303. }
  304. return(value);
  305. }
  306. /***********************************************************************************************
  307. * TTimerClass<T>::operator () -- Function operator for timer object. *
  308. * *
  309. * This function operator for the timer class allows this timer class to be used as the *
  310. * template parameter for other timer class objects. With this ability, one can control *
  311. * several timers (e.g., start or stop them) by using a single controlling timer class *
  312. * that other timers are instantiated from. *
  313. * *
  314. * INPUT: none *
  315. * *
  316. * OUTPUT: Returns with the current time expressed as a long. *
  317. * *
  318. * WARNINGS: none *
  319. * *
  320. * HISTORY: *
  321. * 02/05/1996 JLB : Created. *
  322. *=============================================================================================*/
  323. template<class T>
  324. inline unsigned long TTimerClass<T>::operator () (void) const
  325. {
  326. unsigned long value = Accumulated;
  327. if (Started != 0xFFFFFFFFU) {
  328. value += BasicTimerClass<T>::Value();
  329. }
  330. return(value);
  331. }
  332. /***********************************************************************************************
  333. * TTimerClass<T>::Stop -- Stops the current timer from incrementing. *
  334. * *
  335. * This routine will stop (pause) the timer from further increments. To cause the timer *
  336. * to begin anew, call the Start() function. *
  337. * *
  338. * *
  339. * INPUT: *
  340. * *
  341. * OUTPUT: *
  342. * *
  343. * WARNINGS: *
  344. * *
  345. * HISTORY: *
  346. * 02/05/1996 JLB : Created. *
  347. *=============================================================================================*/
  348. template<class T>
  349. void TTimerClass<T>::Stop(void)
  350. {
  351. if (Started != 0xFFFFFFFFU) {
  352. Accumulated += BasicTimerClass<T>::operator unsigned long();
  353. Started = 0xFFFFFFFFU;
  354. }
  355. }
  356. /***********************************************************************************************
  357. * TTimerClass<T>::Start -- Starts (resumes) a stopped timer. *
  358. * *
  359. * This routine will resume a timer that was previously stopped with the Stop() function. *
  360. * *
  361. * INPUT: none *
  362. * *
  363. * OUTPUT: none *
  364. * *
  365. * WARNINGS: none *
  366. * *
  367. * HISTORY: *
  368. * 02/06/1996 JLB : Created. *
  369. *=============================================================================================*/
  370. template<class T>
  371. void TTimerClass<T>::Start(void)
  372. {
  373. if (Started == 0xFFFFFFFFU) {
  374. Started = Timer();
  375. }
  376. }
  377. /***********************************************************************************************
  378. * TTimerClass<T>::Is_Active -- Checks to see if the timer is counting. *
  379. * *
  380. * Since this timer can be paused, this routine is used to examine the timer to see if it *
  381. * is currently paused or active. If the timer is active, then the return value will be *
  382. * true. *
  383. * *
  384. * INPUT: none *
  385. * *
  386. * OUTPUT: bool; Is this timer currently active? *
  387. * *
  388. * WARNINGS: none *
  389. * *
  390. * HISTORY: *
  391. * 02/06/1996 JLB : Created. *
  392. *=============================================================================================*/
  393. template<class T>
  394. inline bool TTimerClass<T>::Is_Active(void) const
  395. {
  396. return(Started != 0xFFFFFFFFU);
  397. }
  398. /*
  399. ** This timer counts down from the specified (or constructed) value down towards zero.
  400. ** The countdown rate is controlled by the timer object specified. This timer object can
  401. ** be started or stopped. It can also be tested to see if it has expired or not. An expired
  402. ** count down timer is one that has value of zero. You can treat this class object as if it
  403. ** were an integral "magic" long that automatically counts down toward zero.
  404. */
  405. template<class T>
  406. class CDTimerClass : public BasicTimerClass<T> {
  407. public:
  408. // Constructor allows assignment as if class was integral 'long' type.
  409. CDTimerClass(unsigned long set=0);
  410. CDTimerClass(NoInitClass const & x);
  411. ~CDTimerClass(void);
  412. // Fetches current value of count down timer.
  413. unsigned long Value(void) const;
  414. // Conversion operator to allow consistent treatment with integral types.
  415. operator unsigned long(void) const;
  416. // Function operator to allow timer object definition to be cascaded.
  417. unsigned long operator () (void) const;
  418. // Stops (pauses) the timer.
  419. void Stop(void);
  420. // Starts (resumes) the timer.
  421. void Start(void);
  422. // Queries whether the timer is currently active.
  423. bool Is_Active(void) const;
  424. bool Was_Started(void) const { return WasStarted; }
  425. private:
  426. unsigned long DelayTime; // Ticks remaining before countdown timer expires.
  427. bool WasStarted;
  428. };
  429. template<class T>
  430. inline CDTimerClass<T>::CDTimerClass(NoInitClass const & x) :
  431. BasicTimerClass<T>(x), WasStarted(false)
  432. {
  433. }
  434. /***********************************************************************************************
  435. * CDTimerClass<T>::CDTimerClass -- Constructor for count down timer. *
  436. * *
  437. * This is the constructor for the count down timer object. The optional starting value *
  438. * can be used to initiate the timer. Because of this constructor it is possible to assign *
  439. * a long to a count down timer object in order to begin the countdown process. *
  440. * *
  441. * INPUT: set -- The initial starting value for the countdown timer. *
  442. * *
  443. * OUTPUT: none *
  444. * *
  445. * WARNINGS: none *
  446. * *
  447. * HISTORY: *
  448. * 02/06/1996 JLB : Created. *
  449. *=============================================================================================*/
  450. template<class T>
  451. inline CDTimerClass<T>::CDTimerClass(unsigned long set) :
  452. BasicTimerClass<T>(0),
  453. DelayTime(set),
  454. WasStarted(false)
  455. {
  456. }
  457. /***********************************************************************************************
  458. * CDTimerClass<T>::~CDTimerClass -- Destructor for the count down timer object. *
  459. * *
  460. * The destructor for the count down timer object does nothing. *
  461. * *
  462. * INPUT: none *
  463. * *
  464. * OUTPUT: none *
  465. * *
  466. * WARNINGS: none *
  467. * *
  468. * HISTORY: *
  469. * 02/06/1996 JLB : Created. *
  470. *=============================================================================================*/
  471. template<class T>
  472. inline CDTimerClass<T>::~CDTimerClass(void)
  473. {
  474. }
  475. /***********************************************************************************************
  476. * CDTimerClass<T>::Value -- Fetches the current value of the countdown timer. *
  477. * *
  478. * Use this routine to fetch the current value of the timer. It takes into consideration *
  479. * whether the timer has been stopped or not. It returns the correct value regardless of *
  480. * this condition. *
  481. * *
  482. * INPUT: none *
  483. * *
  484. * OUTPUT: Returns with the correct value of this count down timer. *
  485. * *
  486. * WARNINGS: none *
  487. * *
  488. * HISTORY: *
  489. * 07/06/1996 JLB : Created. *
  490. *=============================================================================================*/
  491. template<class T>
  492. inline unsigned long CDTimerClass<T>::Value(void) const
  493. {
  494. unsigned long remain = DelayTime;
  495. if (Started != 0xFFFFFFFFU) {
  496. unsigned long value = BasicTimerClass<T>::Value();
  497. if (value < remain) {
  498. return(remain - value);
  499. } else {
  500. return(0);
  501. }
  502. }
  503. return(remain);
  504. }
  505. /***********************************************************************************************
  506. * CDTimerClass<T>::operator long -- Conversion to long operator function. *
  507. * *
  508. * This conversion operator allows the count down timer object to be used as if it were *
  509. * a "magic" long that automatically counted downward at the controller class tick rate. *
  510. * The count down object can be used in any place that an rvalue long could be used. *
  511. * *
  512. * INPUT: none *
  513. * *
  514. * OUTPUT: Returns with the current count down time expressed in the form of a long value. *
  515. * *
  516. * WARNINGS: none *
  517. * *
  518. * HISTORY: *
  519. * 02/06/1996 JLB : Created. *
  520. *=============================================================================================*/
  521. template<class T>
  522. inline CDTimerClass<T>::operator unsigned long(void) const
  523. {
  524. unsigned long remain = DelayTime;
  525. if (Started != 0xFFFFFFFFU) {
  526. unsigned long value = BasicTimerClass<T>::Value();
  527. if (value < remain) {
  528. return(remain - value);
  529. } else {
  530. return(0);
  531. }
  532. }
  533. return(remain);
  534. }
  535. /***********************************************************************************************
  536. * CDTimerClass<T>::operator () -- Function operator for the count down timer. *
  537. * *
  538. * This is the function operator for the count down timer object. By supporting this *
  539. * function operator, this class (or one derived from this class) could be used as the *
  540. * controlling timer to the timer templates. *
  541. * *
  542. * INPUT: none *
  543. * *
  544. * OUTPUT: Returns with the current count down time expressed in the form of a long. *
  545. * *
  546. * WARNINGS: none *
  547. * *
  548. * HISTORY: *
  549. * 02/06/1996 JLB : Created. *
  550. *=============================================================================================*/
  551. template<class T>
  552. inline unsigned long CDTimerClass<T>::operator () (void) const
  553. {
  554. unsigned long remain = DelayTime;
  555. if (Started != 0xFFFFFFFFU) {
  556. unsigned long value = BasicTimerClass<T>::Value();
  557. if (value < remain) {
  558. return(remain - value);
  559. } else {
  560. return(0);
  561. }
  562. }
  563. return(remain);
  564. }
  565. /***********************************************************************************************
  566. * CDTimerClass<T>::Stop -- Stops (pauses) the count down timer. *
  567. * *
  568. * This routine is used to stop (pause) the count down timer object. A timer object paused *
  569. * in this fashion will be resumed by a call to Start() or by assigning a new count down *
  570. * value to the timer. *
  571. * *
  572. * INPUT: none *
  573. * *
  574. * OUTPUT: none *
  575. * *
  576. * WARNINGS: none *
  577. * *
  578. * HISTORY: *
  579. * 02/06/1996 JLB : Created. *
  580. *=============================================================================================*/
  581. template<class T>
  582. void CDTimerClass<T>::Stop(void)
  583. {
  584. if (Started != 0xFFFFFFFFU) {
  585. DelayTime = *this;
  586. Started = 0xFFFFFFFFU;
  587. }
  588. }
  589. /***********************************************************************************************
  590. * CDTimerClass<T>::Start -- Starts (resumes) the count down timer. *
  591. * *
  592. * This routine is used to start (resume) the count down timer that was previously stopped *
  593. * with the Stop() function. The timer will also resume when a new timer value is assigned. *
  594. * *
  595. * INPUT: none *
  596. * *
  597. * OUTPUT: none *
  598. * *
  599. * WARNINGS: none *
  600. * *
  601. * HISTORY: *
  602. * 02/06/1996 JLB : Created. *
  603. *=============================================================================================*/
  604. template<class T>
  605. void CDTimerClass<T>::Start(void)
  606. {
  607. WasStarted = true;
  608. if (Started == 0xFFFFFFFFU) {
  609. Started = Timer();
  610. }
  611. }
  612. /***********************************************************************************************
  613. * CDTimerClass<T>::Is_Active -- Checks to see if the timer object is active. *
  614. * *
  615. * Because the timer object counting can be stopped, this routine is used to determine *
  616. * if the timer is currently paused or active. *
  617. * *
  618. * INPUT: none *
  619. * *
  620. * OUTPUT: bool; Is the timer currently active? *
  621. * *
  622. * WARNINGS: Note that if the timer has counted down to zero, then it may be active, but *
  623. * the value will, naturally, not change. *
  624. * *
  625. * HISTORY: *
  626. * 02/06/1996 JLB : Created. *
  627. *=============================================================================================*/
  628. template<class T>
  629. inline bool CDTimerClass<T>::Is_Active(void) const
  630. {
  631. return(Started != 0xFFFFFFFFU);
  632. }
  633. #endif