Source code of Windows XP (NT5)
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.

124 lines
1.8 KiB

  1. //
  2. // Microsoft
  3. //
  4. // CollectionAdapterNotifySinks.h
  5. #pragma once
  6. #include "ScopeCriticalSection.h"
  7. //#include "AdapterNotificationSink.h"
  8. #include <list>
  9. #include <algorithm>
  10. class CAdapterSinkBuket
  11. {
  12. public:
  13. CAdapterSinkBuket(IAdapterNotificationSink* pInterface)
  14. {
  15. MYTRACE_ENTER("CAdapterSinkBuket(IAdapterNotificationSink* pInterface)")
  16. m_pInterface = pInterface;
  17. m_pInterface->AddRef();
  18. m_dwCookie = 0;
  19. }
  20. ~CAdapterSinkBuket()
  21. {
  22. m_pInterface->Release();
  23. }
  24. //
  25. // Properties
  26. //
  27. IAdapterNotificationSink* m_pInterface;
  28. DWORD m_dwCookie;
  29. };
  30. //
  31. // Adapters
  32. //
  33. typedef std::list<CAdapterSinkBuket*> LISTOF_ADAPTER_NOTIFICATION_SINK;
  34. enum eNOTIFY
  35. {
  36. eNOTIFY_ADDED,
  37. eNOTIFY_REMOVED,
  38. eNOTIFY_MODIFIED
  39. };
  40. //
  41. //
  42. //
  43. class CCollectionAdapterNotifySinks
  44. {
  45. //
  46. // Properties
  47. //
  48. public:
  49. CComAutoCriticalSection m_AutoCS;
  50. LISTOF_ADAPTER_NOTIFICATION_SINK m_ListOfAdapterSinks;
  51. //
  52. // Methods
  53. //
  54. public:
  55. //
  56. // standard destructor
  57. //
  58. ~CCollectionAdapterNotifySinks();
  59. //
  60. // Add a new Adapter (Thread safe)
  61. //
  62. HRESULT
  63. Add(
  64. IN IAdapterNotificationSink* pAdapterSinkToAdd,
  65. OUT DWORD* pdwNewCookie
  66. );
  67. //
  68. // Remove a adapterSink from the list (Thead safe)
  69. //
  70. HRESULT
  71. Remove(
  72. IN DWORD dwCookie
  73. );
  74. //
  75. // Remove all the IAdapterNotificationSinks from the collection
  76. //
  77. HRESULT
  78. RemoveAll();
  79. //
  80. // Fire a notification to any ALG module requesting notification
  81. //
  82. HRESULT
  83. Notify(
  84. IN eNOTIFY eAction,
  85. IN IAdapterInfo* pIAdapterInfo
  86. );
  87. };