ConsistencyResult.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef CONSISTENCYRESULT_H_
  2. #define CONSISTENCYRESULT_H_
  3. #include "GlobalVariable.h"
  4. #include "CalculateAudio.h"
  5. #include <QDateTime>
  6. enum ERetPythonCompareFile
  7. {
  8. ERCF_0_CompareFile_FALSE = 0, // 对比返回不一致
  9. ERCF_1_CompareFile_TRUE = 1, // 对比返回一致
  10. ERCF_2_CompareFile_NOT = 2, // 未启动文件对比(如服务地址为空)
  11. ERCF_3_CompareFile_Unkonw = 3, // 对比返回未知,判断不出一致性
  12. };
  13. /* 新版本的一致性状态 */
  14. enum class eConsistencyState
  15. {
  16. eCS_Unknown = 0, // 未知状态
  17. eCS_Consistency = 1, // 一致性
  18. eCS_NotConsistency = 2, // 不一致性
  19. eCS_ConsistencyWarning, // 一致性预警
  20. };
  21. /**
  22. * @brief 一致性计算结果,新版本
  23. *
  24. */
  25. struct ConsistencyResult_t
  26. {
  27. ConsistencyResult_t();
  28. ConsistencyResult_t(const ConsistencyResult_t& obj);
  29. ConsistencyResult_t& operator=(const ConsistencyResult_t& obj);
  30. void Init();
  31. /* 添加结果 */
  32. bool AddResult(float fVal);
  33. /* 计算一致性 */
  34. eConsistencyState computeConsistency(int nThresholdNum, float fThreshold, std::string& strInfo);
  35. /* 计算不一致性 */
  36. eConsistencyState computeNotConsistency(int nThresholdNum, float fThreshold, std::string& strInfo);
  37. /* 获取当前已存储的结果个数 */
  38. int GetCount() const { return m_nCurPos; }
  39. private:
  40. float m_fInitThreshold = 0.9; /* 初始化阈值 */
  41. const int m_numArryCount = 10;
  42. float m_arryResult[10]; /* 结果数组 */
  43. int m_nCurPos; /* 当前结果位置 */
  44. };
  45. #endif // CONSISTENCYRESULT_H_