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.

84 lines
2.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1992.
  5. //
  6. // File: SYNCUR.HXX
  7. //
  8. // Contents: Synonym Cursor
  9. //
  10. // Classes: CSynCursor
  11. //
  12. // History: 20-Jan-92 BarotszM and AmyA Created.
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include <ocursor.hxx>
  17. #include <curheap.hxx>
  18. class COccCurStack;
  19. //+---------------------------------------------------------------------------
  20. //
  21. // Class: CSynCursor
  22. //
  23. // Purpose: Synonym cursor, merges several cursors into one ordered cursor
  24. // The cursors have different but semantically synonymous keys.
  25. //
  26. // History: 20-Jan-92 BarotszM and AmyA Created.
  27. // 19-Feb-92 AmyA Changed to be a COccCursor
  28. // instead of a CKeyCursor.
  29. // 23-Jun-94 SitaramR Removed _widMax.
  30. //
  31. // Notice: The cursor contains two heaps that order cursors according to
  32. // occurrences, [_occHeap], and work id's, [_widHeap].
  33. // All cursors in the occurrence heap have the same work id:
  34. // the current work id. If the occurrence heap is empty,
  35. // the top of the wid heap has current work id.
  36. //
  37. //----------------------------------------------------------------------------
  38. class CSynCursor: public COccCursor
  39. {
  40. public:
  41. CSynCursor( COccCurStack &curStack, WORKID widMax );
  42. ~CSynCursor() {} // heaps are deleted
  43. WORKID WorkId();
  44. WORKID NextWorkId();
  45. OCCURRENCE Occurrence();
  46. OCCURRENCE NextOccurrence();
  47. ULONG OccurrenceCount();
  48. OCCURRENCE MaxOccurrence();
  49. ULONG WorkIdCount();
  50. ULONG HitCount();
  51. LONG Rank();
  52. LONG Hit();
  53. LONG NextHit();
  54. void RatioFinished ( ULONG& denom, ULONG& num );
  55. protected:
  56. BOOL ReplenishOcc();
  57. COccHeapOfOccCur _occHeap;
  58. CWidHeapOfOccCur _widHeap;
  59. };