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.

96 lines
3.0 KiB

  1. #if !defined(MOTION__Action_h__INCLUDED)
  2. #define MOTION__Action_h__INCLUDED
  3. /***************************************************************************\
  4. *
  5. * class Action
  6. *
  7. * Action maintains a single action to be called by the Scheduler at the
  8. * appointed time.
  9. *
  10. \***************************************************************************/
  11. class Action : public BaseObject, public ListNodeT<Action>
  12. {
  13. // Construction
  14. public:
  15. Action();
  16. virtual ~Action(); // Must use xwUnlock() to remove
  17. protected:
  18. virtual BOOL xwDeleteHandle();
  19. public:
  20. static Action * Build(GList<Action> * plstParent, const GMA_ACTION * pma,
  21. DWORD dwCurTick, BOOL fPresent);
  22. // Operations
  23. public:
  24. inline BOOL IsPresent() const;
  25. inline BOOL IsComplete() const;
  26. inline DWORD GetStartTime() const;
  27. inline void SetPresent(BOOL fPresent);
  28. inline void SetParent(GList<Action> * plstParent);
  29. inline float GetStartDelay() const;
  30. inline DWORD GetIdleTimeOut(DWORD dwCurTick) const;
  31. inline DWORD GetPauseTimeOut() const;
  32. inline Thread * GetThread() const;
  33. inline void ResetPresent(DWORD dwCurTick);
  34. inline void ResetFuture(DWORD dwCurTick, BOOL fInit);
  35. void Process(DWORD dwCurTick, BOOL * pfFinishedPeriod, BOOL * pfFire);
  36. void EndPeriod();
  37. void xwFireNL();
  38. void xwFireFinalNL();
  39. inline void MarkDelete(BOOL fDelete);
  40. #if DBG
  41. void DEBUG_MarkInFire(BOOL fInFire);
  42. #endif // DBG
  43. // BaseObject Interface
  44. public:
  45. virtual HandleType GetHandleType() const { return htAction; }
  46. virtual UINT GetHandleMask() const { return 0; }
  47. // Implementation
  48. protected:
  49. static void CALLBACK
  50. EmptyActionProc(GMA_ACTIONINFO * pmai);
  51. // Data
  52. protected:
  53. Thread * m_pThread;
  54. GMA_ACTION m_ma;
  55. GList<Action> * m_plstParent;
  56. UINT m_cEventsInPeriod;
  57. UINT m_cPeriods;
  58. DWORD m_dwStartTick;
  59. DWORD m_dwLastProcessTick;
  60. BOOL m_fPresent:1;
  61. BOOL m_fSingleShot:1;
  62. BOOL m_fDestroy:1; // Action is being destroyed
  63. BOOL m_fDeleteInFire:1; // Action should be deleted during
  64. // the next xwFire().
  65. // Cache some data from last call to Process() to be used in
  66. // xwFire().
  67. #if DBG
  68. BOOL m_DEBUG_fFireValid;
  69. BOOL m_DEBUG_fInFire;
  70. #endif // DBG
  71. float m_flLastProgress;
  72. // Need to make the collection classes friends to give access to destructor.
  73. // NOTE: These lists should never actually destroy the objects.
  74. friend GList<Action>;
  75. };
  76. #include "Action.inl"
  77. #endif // MOTION__Action_h__INCLUDED