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.

68 lines
1.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1991, Microsoft Corporation.
  4. //
  5. // File: XlatStat.hxx
  6. //
  7. // Contents: State translation class.
  8. //
  9. // Classes: CXlatState
  10. //
  11. // History: 01-20-92 KyleP Created
  12. //
  13. //--------------------------------------------------------------------------
  14. #pragma once
  15. #ifdef DISPLAY_INCLUDES
  16. #pragma message( "#include <" __FILE__ ">..." )
  17. #endif
  18. class CStateSet;
  19. //+-------------------------------------------------------------------------
  20. //
  21. // Class: CXlatState
  22. //
  23. // Purpose: Maps state set to single state.
  24. //
  25. // History: 20-Jan-92 KyleP Created
  26. //
  27. //--------------------------------------------------------------------------
  28. class CXlatState
  29. {
  30. public:
  31. CXlatState( UINT MaxState = 32 );
  32. ~CXlatState();
  33. UINT XlatToOne( CStateSet const & ss );
  34. void XlatToMany( UINT iState, CStateSet & ss );
  35. private:
  36. void _Realloc();
  37. UINT _Search( CStateSet const & ss );
  38. UINT _Create( CStateSet const & ss );
  39. void _BuildState( ULONG * pState, CStateSet const & ss );
  40. //
  41. // Initial naive implementation: Just keep an array, where each
  42. // element is wide enough to contain 1 bit per possible state.
  43. //
  44. // The first state set in _pulStates is used as temporary space
  45. // during search.
  46. //
  47. UINT _StateSize; // # DWords / state
  48. ULONG * _pulStates; // Pointer to states
  49. UINT _cStates; // Size (in states) of pulStates
  50. UINT _cUsed; // Number of states in use.
  51. };