Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.2 KiB

  1. /*
  2. * REVISIONS:
  3. * pcy30Nov92: Changed obj.h to apcobj.h; InsertEventTimer now returns VOID.
  4. * jod07Dec92: Added a pure virtual Wait function to TimerManager.
  5. * pcy11Dec92: Added global _theTimerManager
  6. * ane11Dec92: Moved mainapp.h
  7. * ane16Dec92: Added default constructors for date/time classes
  8. * ane22Dec92: Added constructor to take string of form "8:00 AM"
  9. * ane11Jan93: Changed theTimerList to a sortable list
  10. * ane08Feb93: Added new RemoveEventTimer function
  11. * ajr22Feb93: Changed case of mainApp.h to mainapp.h
  12. * jod05Apr93: Added changes for Deep Discharge
  13. * cad09Jul93: allowing access to findeventtimer
  14. * cad16Sep93: Added -, < operators to DateObj, made some methods const
  15. * cad28Sep93: Made sure destructor(s) virtual
  16. * cad12Oct93: Added == operator
  17. * ajr02May95: Need to stop carrying time in milliseconds
  18. * tjg26Jan98: Added Stop method
  19. * mholly03Dec98 : removed theAccessLock and instead use the Access/Release
  20. * methods already available in theTimerList. Also removed
  21. * the Suspend()/Release()/IsSuspended() methods (not used)
  22. */
  23. #ifndef _TIMERMAN_H
  24. #define _TIMERMAN_H
  25. extern "C" {
  26. #include <time.h>
  27. }
  28. #include "apc.h"
  29. #include "_defs.h"
  30. _CLASSDEF(TimerManager)
  31. _CLASSDEF(EventTimer)
  32. _CLASSDEF(ProtectedSortedList)
  33. _CLASSDEF(MainApplication)
  34. #include "err.h"
  35. #include "apcobj.h"
  36. #include "update.h"
  37. #include "datetime.h"
  38. //
  39. // Global
  40. //
  41. extern PTimerManager _theTimerManager;
  42. class TimerManager : public UpdateObj {
  43. public:
  44. TimerManager(PMainApplication anApplication);
  45. virtual ~TimerManager();
  46. virtual INT Update(PEvent anEvent);
  47. virtual PEventTimer FindEventTimer(ULONG TimerID);
  48. virtual VOID CancelTimer(ULONG TimerID);
  49. virtual ULONG SetTheTimer(PDateTimeObj aDateTime,
  50. PEvent anEvent,
  51. PUpdateObj anUpdateObj);
  52. virtual ULONG SetTheTimer(ULONG SecondsDelay,
  53. PEvent anEvent,
  54. PUpdateObj anUpdateObj);
  55. ULONG GetTimeEventOccurs(ULONG aTimerId);
  56. virtual VOID Wait(ULONG Delay) = 0;
  57. PDateTimeObj CalculateDailyTime(RTimeObj aTime, ULONG threshold = 0);
  58. PDateTimeObj CalculateWeeklyTime(RWeekObj aDay, RTimeObj aTime);
  59. PDateTimeObj CalculateMonthlyTime (RWeekObj aDay, RTimeObj aTime);
  60. PDateTimeObj CalculateMonthlyTime (PCHAR aDay, PCHAR aTime);
  61. VOID CalculateNextDay (ULONG daysInMonth,
  62. ULONG theMonth,
  63. ULONG &newDay,
  64. ULONG &newMonth,
  65. ULONG &newYear);
  66. virtual VOID Stop() { };
  67. virtual BOOL ExecuteTimer();
  68. protected:
  69. ULONG theSystemTime;
  70. PMainApplication theApplication;
  71. virtual VOID InsertEventTimer(PEventTimer anEventTimer);
  72. virtual VOID RemoveEventTimer(ULONG TimerID);
  73. virtual VOID RemoveEventTimer(PEventTimer anEventTimer);
  74. virtual VOID NotifyClient(PEventTimer anEventTimer);
  75. PProtectedSortedList theTimerList;
  76. };
  77. #endif