#include "GlobalVariable.h" /* ==================================================================== * CompareItemInfo_t对比项结构体 * ==================================================================== */ bool CompareItemRoadInfo_t::operator==(const CompareItemRoadInfo_t &other) const { return (isEnableRecord == other.isEnableRecord && nCompareRoadNum == other.nCompareRoadNum && strCompareRoadName == other.strCompareRoadName && scRoadInfo.nSoundCardNum == other.scRoadInfo.nSoundCardNum && scRoadInfo.strSoundCardID == other.scRoadInfo.strSoundCardID && scRoadInfo.strSoundCardName == other.scRoadInfo.strSoundCardName && scRoadInfo.roadInfo.nRoadNum == other.scRoadInfo.roadInfo.nRoadNum && scRoadInfo.roadInfo.nChannelID == other.scRoadInfo.roadInfo.nChannelID && scRoadInfo.roadInfo.strChannelName == other.scRoadInfo.roadInfo.strChannelName ); } CompareItemDetectParam_t& CompareItemDetectParam_t::operator=(const CompareItemDetectParam_t &other) { if(this == &other) { return *this; } isEnable = other.isEnable; threshold = other.threshold; nLen = other.nLen; nSensitivity = other.nSensitivity; return *this; } CompareItemInfo_t::CompareItemInfo_t(const CompareItemInfo_t &other) { *this = other; } CompareItemInfo_t& CompareItemInfo_t::operator=(const CompareItemInfo_t &other) { if(this == &other) { return *this; } nID = other.nID; strName = other.strName; isEnable = other.isEnable; mapRoad = other.mapRoad; paramMute = other.paramMute; paramOverload = other.paramOverload; paramPhase = other.paramPhase; return *this; } /* 判断对比想基础部分是否相等,不包含通道信息 */ bool CompareItemInfo_t::isEqualBase(const CompareItemInfo_t &other) const { if(nID != other.nID || strName != other.strName || isEnable != other.isEnable) { return false; } if(mapRoad.size() != other.mapRoad.size()) { return false; // 通道数量不同 } if(paramMute.isEnable != other.paramMute.isEnable || paramMute.threshold.nThreshold != other.paramMute.threshold.nThreshold || paramMute.nLen != other.paramMute.nLen || paramMute.nSensitivity != other.paramMute.nSensitivity) { return false; } if(paramOverload.isEnable != other.paramOverload.isEnable || paramOverload.threshold.nThreshold != other.paramOverload.threshold.nThreshold || paramOverload.nLen != other.paramOverload.nLen || paramOverload.nSensitivity != other.paramOverload.nSensitivity) { return false; } if(paramPhase.isEnable != other.paramPhase.isEnable || paramPhase.threshold.dThreshold != other.paramPhase.threshold.dThreshold || paramPhase.nLen != other.paramPhase.nLen || paramPhase.nSensitivity != other.paramPhase.nSensitivity) { return false; } return true; } /* 判断对比项的通道是否相同 */ bool CompareItemInfo_t::isEqualRoads(const CompareItemInfo_t &other) const { if(mapRoad.size() != other.mapRoad.size()) { return false; } for(auto it = mapRoad.cbegin(); it != mapRoad.cend(); ++it) { auto otherIt = other.mapRoad.find(it.key()); if(otherIt == other.mapRoad.cend()) { return false; // 在other中找不到对应的通道 } if(it.value() == otherIt.value()) { }else { return false; // 通道信息不相同 } } return true; }