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.

188 lines
3.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: sinklist.hxx
  7. //
  8. // Contents: Linked list class
  9. //
  10. // Classes: CSinkList
  11. // CConnectionPoint
  12. //
  13. // Functions:
  14. //
  15. // History: 24-Dec-95 SusiA Created
  16. //
  17. //----------------------------------------------------------------------------
  18. #ifndef __SINKLIST_HXX__
  19. #define __SINKLIST_HXX__
  20. class CSafeSem;
  21. #include <iconn.h>
  22. //+---------------------------------------------------------------------------
  23. //
  24. // Class: CSinkList
  25. //
  26. // Purpose: Generic linked list class for use by async docfiles
  27. //
  28. // Interface:
  29. //
  30. // History: 24-Dec-95 SusiA Created
  31. //
  32. // Notes:
  33. //
  34. //----------------------------------------------------------------------------
  35. class CSinkList
  36. {
  37. public:
  38. inline CSinkList();
  39. inline CSinkList *GetNext(void);
  40. inline void SetNext(CSinkList *psl);
  41. inline DWORD GetCookie(void);
  42. inline void SetCookie(DWORD dwCookie);
  43. inline IProgressNotify *GetProgressNotify(void);
  44. inline void SetProgressNotify(IProgressNotify *ppn);
  45. private:
  46. IProgressNotify *_ppn;
  47. DWORD _dwCookie;
  48. CSinkList *_pslNext;
  49. };
  50. inline CSinkList::CSinkList()
  51. {
  52. _ppn = NULL;
  53. _dwCookie = 0;
  54. _pslNext = NULL;
  55. }
  56. inline CSinkList * CSinkList::GetNext(void)
  57. {
  58. return _pslNext;
  59. }
  60. inline void CSinkList::SetNext(CSinkList *psl)
  61. {
  62. _pslNext = psl;
  63. }
  64. inline DWORD CSinkList::GetCookie(void)
  65. {
  66. return _dwCookie;
  67. }
  68. inline void CSinkList::SetCookie(DWORD dwCookie)
  69. {
  70. _dwCookie = dwCookie;
  71. }
  72. inline IProgressNotify *CSinkList::GetProgressNotify(void)
  73. {
  74. return _ppn;
  75. }
  76. inline void CSinkList::SetProgressNotify(IProgressNotify *ppn)
  77. {
  78. _ppn = ppn;
  79. }
  80. //+---------------------------------------------------------------------------
  81. //
  82. // Class: CConnectionPoint
  83. //
  84. // Purpose:
  85. //
  86. // Interface:
  87. //
  88. // History: 28-Dec-95 SusiA Created
  89. //
  90. // Notes:
  91. //
  92. //----------------------------------------------------------------------------
  93. class CConnectionPoint: public IDocfileAsyncConnectionPoint
  94. {
  95. public:
  96. CConnectionPoint();
  97. ~CConnectionPoint();
  98. inline CSinkList *GetHead(void);
  99. void TakeCS(void);
  100. void ReleaseCS(void);
  101. //From IUnknown
  102. STDMETHOD(QueryInterface)(REFIID iid, void **ppvObj);
  103. STDMETHOD_(ULONG,AddRef)(void);
  104. STDMETHOD_(ULONG,Release)(void);
  105. #ifdef ASYNC
  106. #else
  107. SCODE Notify(SCODE scFailure,
  108. IFillLockBytes *piflb,
  109. BOOL fDefaultLockBytes);
  110. #endif
  111. //From IDocfileAsyncConnectionPoint
  112. STDMETHOD(AddConnection)(IProgressNotify *pUnkSink,
  113. DWORD *pdwCookie);
  114. STDMETHOD(RemoveConnection)(DWORD dwCookie);
  115. STDMETHOD(NotifySinks)(ULONG ulProgressCurrent,
  116. ULONG ulProgressMaximum,
  117. BOOL fAccurate,
  118. SCODE sc);
  119. STDMETHOD(GetParent)(IDocfileAsyncConnectionPoint **ppParent);
  120. SCODE Clone (CConnectionPoint *pcp);
  121. inline DWORD GetCookie(void);
  122. inline void SetParent(IDocfileAsyncConnectionPoint *pParentCP);
  123. SCODE Init();
  124. private:
  125. DWORD _dwCookie;
  126. LONG _cReferences;
  127. CSinkList *_pSinkHead;
  128. IDocfileAsyncConnectionPoint *_pParentCP;
  129. BOOL _fCSInitialized;
  130. CRITICAL_SECTION _csSinkList;
  131. };
  132. inline CSinkList * CConnectionPoint::GetHead(void)
  133. {
  134. return _pSinkHead;
  135. }
  136. inline DWORD CConnectionPoint::GetCookie(void)
  137. {
  138. return _dwCookie;
  139. }
  140. inline void CConnectionPoint::SetParent(
  141. IDocfileAsyncConnectionPoint *pParentCP)
  142. {
  143. _pParentCP = pParentCP;
  144. if (_pParentCP != NULL)
  145. _pParentCP->AddRef();
  146. }
  147. #endif // #ifndef __SINKLIST_HXX__