refs #104 replaced all remaining hash-based comparisons with the multimethod compare()

This commit is contained in:
Mathew Sutcliffe
2014-02-17 15:39:01 +00:00
parent dd4e2c58f3
commit 2dd72c6d3e
6 changed files with 30 additions and 10 deletions

View File

@@ -44,9 +44,19 @@ namespace BlackMisc
/*
* Compare
*/
int CAircraftSituation::compareImpl(const CValueObject &/*otherBase*/) const
int CAircraftSituation::compareImpl(const CValueObject &otherBase) const
{
qFatal("not implemented");
const auto &other = static_cast<const CAircraftSituation &>(otherBase);
int result;
if ((result = compare(this->m_position, other.m_position))) { return result; }
if ((result = compare(this->m_altitude, other.m_altitude))) { return result; }
if ((result = compare(this->m_heading, other.m_heading))) { return result; }
if ((result = compare(this->m_pitch, other.m_pitch))) { return result; }
if ((result = compare(this->m_bank, other.m_bank))) { return result; }
if ((result = compare(this->m_groundspeed, other.m_groundspeed))) { return result; }
if (this->m_timestamp < other.m_timestamp) { return -1; }
if (this->m_timestamp > other.m_timestamp) { return 1; }
return 0;
}
@@ -84,7 +94,7 @@ namespace BlackMisc
bool CAircraftSituation::operator ==(const CAircraftSituation &other) const
{
if (this == &other) return true;
return this->getValueHash() == other.getValueHash();
return compare(*this, other) == 0;
}
/*