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.

151 lines
6.3 KiB

  1. /*****************************************************************************
  2. * (C) COPYRIGHT MICROSOFT CORPORATION, 2002
  3. *
  4. * AUTHOR: ByronC
  5. *
  6. * DATE: 3/24/2002
  7. *
  8. * @doc INTERNAL
  9. *
  10. * @module WiaEventClient.h - Definition file for <c WiaEventClient> |
  11. *
  12. * This file contains the class definition for the <c WiaEventClient> base
  13. * class.
  14. *
  15. *****************************************************************************/
  16. //
  17. // Defines
  18. //
  19. #define WiaEventClient_UNINIT_SIG 0x55636557
  20. #define WiaEventClient_INIT_SIG 0x49636557
  21. #define WiaEventClient_TERM_SIG 0x54636557
  22. #define WiaEventClient_DEL_SIG 0x44636557
  23. /*****************************************************************************
  24. *
  25. * @doc INTERNAL
  26. *
  27. * @class WiaEventClient | Base class used to store and manage run-time event
  28. * information for a paricular WIA client.
  29. *
  30. * @comm
  31. * Each client that registers for event notifications will have an instance
  32. * of this class on the server. Each time an event registration is made,
  33. * the server checks whether the given client can be found . If not, it
  34. * creates a new one of these, adding it to the list of registered clients.
  35. * Once we know the client context definitely exists, and any event registration
  36. * info is added to the appropriate instance of this class.
  37. *
  38. * This is a base class that is used to implements most of the above behavior.
  39. * However, transport specific information is left up to sub-classes to
  40. * implement e.g. in order to send an event notification to a client over,
  41. * AsyncRPC, we need an RPC_ASYNC_STATE and so on, which only a
  42. * <c AsyncRpcEventClient> will know how to handle.
  43. *
  44. *****************************************************************************/
  45. class WiaEventClient
  46. {
  47. //@access Public members
  48. public:
  49. // @cmember Constructor
  50. WiaEventClient(STI_CLIENT_CONTEXT ClientContext);
  51. // @cmember Destructor
  52. virtual ~WiaEventClient();
  53. // @cmember Increment reference count
  54. virtual ULONG __stdcall AddRef();
  55. // @cmember Decrement reference count
  56. virtual ULONG __stdcall Release();
  57. // @cmember Initializer method
  58. virtual HRESULT Initialize();
  59. // @cmember Checks whether the client is interested in the event from the given device.
  60. virtual BOOL IsRegisteredForEvent(WiaEventInfo *pWiaEventInfo);
  61. // @cmember Add/Remove a client registration.
  62. virtual HRESULT RegisterUnregisterForEventNotification(EventRegistrationInfo *pEventRegistrationInfo);
  63. // @cmember Add a pending event.
  64. virtual HRESULT AddPendingEventNotification(WiaEventInfo *pWiaEventInfo);
  65. // @cmember Returns the context identifying this client
  66. virtual STI_CLIENT_CONTEXT getClientContext();
  67. // @cmember Sets the mark to indicate that this object should be removed
  68. virtual VOID MarkForRemoval();
  69. // @cmember Check the mark to indicate whether this object should be removed
  70. virtual BOOL isMarkedForRemoval();
  71. //@access Protected members
  72. protected:
  73. // @cmember Checks whether a semantically equal <c EventRegistrationInfo> is in the list
  74. EventRegistrationInfo* FindEqualEventRegistration(EventRegistrationInfo *pEventRegistrationInfo);
  75. // @cmember Walks event registration list and releases all elements.
  76. VOID DestroyRegistrationList();
  77. // @cmember Walks event event list and releases all elements.
  78. VOID DestroyPendingEventList();
  79. // @cmember Signature of class
  80. ULONG m_ulSig;
  81. // @cmember Ref count
  82. ULONG m_cRef;
  83. // @cmember Context which uniquely identifies this client to the server
  84. STI_CLIENT_CONTEXT m_ClientContext;
  85. // @cmember List holding the client's event registration data
  86. CSimpleLinkedList<EventRegistrationInfo*> m_ListOfEventRegistrations;
  87. // @cmember List holding the client's pending events
  88. CSimpleQueue<WiaEventInfo*> m_ListOfEventsPending;
  89. // @cmember Synchronization primitive used to protect access to the internal lists held by this class
  90. CRIT_SECT m_csClientSync;
  91. // @cmember Set to TRUE when this object should be removed
  92. BOOL m_bRemove;
  93. //
  94. // Comments for member variables
  95. //
  96. // @mdata ULONG | WiaEventClient | m_ulSig |
  97. // The signature for this class, used for debugging purposes.
  98. // Doing a <nl>"db [addr_of_class]"<nl> would yield one of the following
  99. // signatures for this class:
  100. // @flag WiaEventClient_UNINIT_SIG | 'WecU' - Object has not been successfully
  101. // initialized
  102. // @flag WiaEventClient_INIT_SIG | 'WecI' - Object has been successfully
  103. // initialized
  104. // @flag WiaEventClient_TERM_SIG | 'WecT' - Object is in the process of
  105. // terminating.
  106. // @flag WiaEventClient_INIT_SIG | 'WecD' - Object has been deleted
  107. // (destructor was called)
  108. //
  109. //
  110. // @mdata ULONG | WiaEventClient | m_cRef |
  111. // The reference count for this class. Used for lifetime
  112. // management.
  113. //
  114. // @mdata STI_CLIENT_CONTEXT | WiaEventClient | m_ClientContext |
  115. // Context which uniquely identifies this client to the server
  116. //
  117. // @mdata CSimpleLinkedList<lt>WIA_EVENT_REG_DATA*<gt> | WiaEventClient | m_ListOfEventRegistrations |
  118. // List holding the client's event registration data. This is used to check whether a given event
  119. // notification is needed by a client. If the client has at least one registration matching the
  120. // event notification, the event is added to the list of pending events.
  121. //
  122. // @mdata CSimpleLinkedList<lt>WIA_EVENT_DATA*<gt> | WiaEventClient | m_ListOfEventsPending |
  123. // Each event notification needed by clients is added to this list of pending events for
  124. // later retrieval. Sub-classes actually decide when to notify the client, and therefore when to
  125. // de-queue an event.
  126. //
  127. // @mdata CRIT_SECT | WiaEventClient | m_csClientSync |
  128. // Synchronization primitive used to protect access to the internal lists held by this class
  129. //
  130. // @mdata BOOL | WiaEventClient | m_bRemove |
  131. // Keeps track of whether this object is marked for removal. When an object is marked
  132. // for removal, it may still be used as normal, but will be removed at the next available opertunity.
  133. //
  134. };