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.

63 lines
1.8 KiB

  1. //******************************************************************************
  2. //
  3. // POSTPONE.H
  4. //
  5. // Copyright (C) 1996-1999 Microsoft Corporation
  6. //
  7. //******************************************************************************
  8. #ifndef __WBEM_ESS_POSTPONE__H_
  9. #define __WBEM_ESS_POSTPONE__H_
  10. #include <arrtempl.h>
  11. #include <wbemcomn.h>
  12. class CEssNamespace;
  13. class CPostponedRequest
  14. {
  15. CEssNamespace* m_pNamespace; // stored for an assertion at execute()
  16. public:
  17. CPostponedRequest() : m_pNamespace(NULL) {}
  18. virtual ~CPostponedRequest(){}
  19. void SetNamespace( CEssNamespace* pNamespace ) { m_pNamespace=pNamespace; }
  20. CEssNamespace* GetNamespace() { return m_pNamespace; }
  21. virtual HRESULT Execute(CEssNamespace* pNamespace) = 0;
  22. //
  23. // if a postponed request holds a CExecLine::Turn, then override this
  24. // method to return TRUE. ( used for debugging purposes - we want to know
  25. // if a postponed list is holding any turns )
  26. //
  27. virtual BOOL DoesHoldTurn() { return FALSE; }
  28. };
  29. class CPostponedList
  30. {
  31. protected:
  32. ULONG m_cTurnsHeld;
  33. CUniquePointerQueue<CPostponedRequest> m_qpRequests;
  34. public:
  35. typedef enum
  36. {
  37. e_StopOnFailure, e_ReturnOneError
  38. } EPostponedExecuteFlags;
  39. CPostponedList() : m_qpRequests(0), m_cTurnsHeld(0) {}
  40. virtual ~CPostponedList(){}
  41. BOOL IsEmpty() { return m_qpRequests.GetQueueSize() == 0; }
  42. BOOL IsHoldingTurns() { return m_cTurnsHeld > 0; }
  43. HRESULT AddRequest( CEssNamespace* pNamespace,
  44. ACQUIRE CPostponedRequest* pReq );
  45. HRESULT Execute( CEssNamespace* pNamespace,
  46. EPostponedExecuteFlags eFlags,
  47. DELETE_ME CPostponedRequest** ppFailed = NULL);
  48. HRESULT Clear();
  49. };
  50. #endif