encodertypeentry.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. //
  19. // Filename: encodertypeentry.h
  20. // Project: wwbitpack.lib
  21. // Author: Tom Spencer-Smith
  22. // Date: June 2000
  23. // Description:
  24. //
  25. //-----------------------------------------------------------------------------
  26. #if defined(_MSV_VER)
  27. #pragma once
  28. #endif
  29. #ifndef ENCODERTYPEENTRY_H
  30. #define ENCODERTYPEENTRY_H
  31. #include "bittype.h"
  32. class cEncoderTypeEntry
  33. {
  34. public:
  35. cEncoderTypeEntry::cEncoderTypeEntry();
  36. void Init(double min, double max, double resolution);
  37. void Init(int num_bits);
  38. bool Scale(double value, ULONG & scaled_value);
  39. double Unscale(ULONG u_value);
  40. double Clamp(double value);
  41. UINT Get_Bit_Precision() const {return BitPrecision;}
  42. double Get_Resolution() const {return Resolution;}
  43. bool Is_Valid() const;
  44. void Invalidate();
  45. bool Is_Value_In_Range(double value) const;
  46. private:
  47. cEncoderTypeEntry(const cEncoderTypeEntry& source); // Disallow
  48. cEncoderTypeEntry& operator=(const cEncoderTypeEntry& rhs); // Disallow
  49. void Calc_Bit_Precision(double resolution);
  50. double Min;
  51. double Max;
  52. double Resolution;
  53. UINT BitPrecision;
  54. };
  55. #endif // ENCODERTYPEENTRY_H