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.

120 lines
2.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 2000.
  5. //
  6. // File: wnotifmg.hxx
  7. //
  8. // Contents: BigTable to Client notifications manager.
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 11-30-94 srikants Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #pragma once
  18. class CNotificationRegion;
  19. class CRowIndex;
  20. class CNotificationMgr
  21. {
  22. public:
  23. CNotificationMgr( CRowIndex & rowIndexSnap )
  24. : _rowIndexSnap(rowIndexSnap),
  25. _fSignalled(FALSE),
  26. _fFullRegion(FALSE)
  27. {}
  28. // Check if any notification regions are currently active.
  29. BOOL IsEmpty() const
  30. {
  31. return !_fFullRegion;
  32. }
  33. // Check if any of the notification regions have already detected a
  34. // change.
  35. BOOL IsSignalled() const { return _fSignalled; }
  36. void SetSignalled () { _fSignalled = TRUE; }
  37. void ClearSignalled() { _fSignalled = FALSE; }
  38. // Region manipulation routines.
  39. void AddRegion( const CNotificationRegion & region );
  40. void DeleteRegion( const CNotificationRegion & region );
  41. void ExtendRegion( const CNotificationRegion & regionOld,
  42. const CNotificationRegion & regionNew );
  43. void ShrinkRegion( const CNotificationRegion & regionOld,
  44. const CNotificationRegion & regionNew );
  45. // To make the entire region a notification region.
  46. void AddFullRegion()
  47. {
  48. _fFullRegion = TRUE;
  49. }
  50. void DeleteAllRegions()
  51. {
  52. _fFullRegion = FALSE;
  53. }
  54. //
  55. // Check to see if the given row is being added in the notification
  56. // region.
  57. //
  58. BOOL IsAddInNotifyRegion( ULONG oTableRow )
  59. {
  60. return _fFullRegion;
  61. }
  62. //
  63. // Check to see if the given row is being deleted from a notification
  64. // region.
  65. //
  66. BOOL IsDeleteInNotifyRegion( ULONG oTableRow )
  67. {
  68. return _fFullRegion;
  69. }
  70. void SplitRegion( CNotificationMgr & left, CNotificationMgr & right,
  71. ULONG oSplitRow )
  72. {
  73. if ( !_fFullRegion )
  74. {
  75. left.DeleteAllRegions();
  76. right.DeleteAllRegions();
  77. }
  78. else
  79. {
  80. left.AddFullRegion();
  81. right.AddFullRegion();
  82. }
  83. }
  84. private:
  85. // Snap shot of the row index on which notification regions are defined.
  86. CRowIndex & _rowIndexSnap;
  87. // Flag indicating if any of the notification regions have already seen
  88. // a change.
  89. BOOL _fSignalled;
  90. // The entire region is of interest for notifications
  91. BOOL _fFullRegion;
  92. };