#ifndef CONSISTENCYRESULT_H_ #define CONSISTENCYRESULT_H_ #include "GlobalVariable.h" #include "ChannelParam.h" #include enum ERetPythonCompareFile { ERCF_0_CompareFile_FALSE = 0, // 对比返回不一致 ERCF_1_CompareFile_TRUE = 1, // 对比返回一致 ERCF_2_CompareFile_NOT = 2, // 未启动文件对比(如服务地址为空) ERCF_3_CompareFile_Unkonw = 3, // 对比返回未知,判断不出一致性 }; // 保存1次一致性比较的结果,大概1秒钟的数据 struct StConsistencyResult { StConsistencyResult(); StConsistencyResult(StConsistencyParam ¶m); virtual ~StConsistencyResult(); StConsistencyResult(const StConsistencyResult& obj); StConsistencyResult& operator=(const StConsistencyResult& obj); void Init(); std::string OutPutConsistencyInfo(const bool bConsistencyInfo); int AddResult(const float f, const int iDelN); int GetCount() const { return iCurPos; } int GetMaxResult() const; // 这个一致性不能用于判定是否一致性,一致性判定要在CConsistencyList里面判定,计算一致性的个数 bool IsConsistency() const; bool IsNotConsistency() const; bool m_bIsNoiseOfCur; StConsistencyParam m_stConsistencyParam; StConsistencyParam m_stNoiseConsistencyParam; int GetConsistencyThresholdNum() const; int GetConsistencyThresholdNotNum() const; int GetConsistencyThresholdWarningNum() const; int GetDelNAt(const int nIndex = 0) const { return aryOfDelN[nIndex]; } // Python对比结果 // int m_nRetPythonCompareFile; // AI对比结果 void InitAICompareFile(); int AddRetAICompareFile(float fVal); // nThresholdNum表示持续次数, dThresholdNum判断阀值 bool IsAIConsistency(int nThresholdNum, float dThreshold, std::string &strAIValue); bool IsAINotConsistency(int nThresholdNum, float dThreshold, std::string &strAIValue); int GetLastRetAICompareFile(); private: QDateTime m_tLastAITime; int m_nLastRetAICompareFile; // AI对比结果,范围[0,1] float aryOfAICompareFile[10]; /* fResult 相似度 delN 偏差(时间偏移) 这里的偏差就是错位的意思,相似度是在这个错位下计算出来的,如下: 1010001011010101110 xxx1010001011010101110 xxx的位数就是偏差量了 */ int aryOfDelN[RESULT_NUM_OF_ONETIME_COMPARE]; // 相似度数组 float aryOfSimilarity[RESULT_NUM_OF_ONETIME_COMPARE]; // 数组实际保存了多少个数据,当前可以填充数据的位置 int iCurPos; }; #endif // CONSISTENCYRESULT_H_