#ifndef CONSISTENCYRESULT_H_ #define CONSISTENCYRESULT_H_ #include "GlobalVariable.h" #include "CalculateAudio.h" #include enum ERetPythonCompareFile { ERCF_0_CompareFile_FALSE = 0, // 对比返回不一致 ERCF_1_CompareFile_TRUE = 1, // 对比返回一致 ERCF_2_CompareFile_NOT = 2, // 未启动文件对比(如服务地址为空) ERCF_3_CompareFile_Unkonw = 3, // 对比返回未知,判断不出一致性 }; /* 新版本的一致性状态 */ enum class eConsistencyState { eCS_Unknown = 0, // 未知状态 eCS_Consistency = 1, // 一致性 eCS_NotConsistency = 2, // 不一致性 eCS_ConsistencyWarning, // 一致性预警 }; /** * @brief 一致性计算结果,新版本 * */ struct ConsistencyResult_t { ConsistencyResult_t(); ConsistencyResult_t(const ConsistencyResult_t& obj); ConsistencyResult_t& operator=(const ConsistencyResult_t& obj); void Init(); /* 添加结果 */ bool AddResult(float fVal); /* 计算一致性 */ eConsistencyState computeConsistency(int nThresholdNum, float fThreshold, std::string& strInfo); /* 计算不一致性 */ eConsistencyState computeNotConsistency(int nThresholdNum, float fThreshold, std::string& strInfo); /* 获取当前已存储的结果个数 */ int GetCount() const { return m_nCurPos; } private: float m_fInitThreshold = 0.9; /* 初始化阈值 */ const int m_numArryCount = 10; float m_arryResult[10]; /* 结果数组 */ int m_nCurPos; /* 当前结果位置 */ }; #endif // CONSISTENCYRESULT_H_