1
0
Fork 0

allow devices to be sorted by startaddress

This commit is contained in:
Kevin Matz 2023-04-01 11:17:29 -04:00
parent 55a120dfed
commit 6486775626
2 changed files with 17 additions and 0 deletions

View File

@ -114,4 +114,19 @@ bool Device::setAddress(uint16_t start)
return true;
}
/**
* @brief Device::operator <
* @param other
* @return
*
* Allow Devices to be members of sorted STL containers.
*/
bool Device::operator< (const Device &other ) const
{
if (startAddress_ == other.startAddress_)
return footprint() < other.footprint();
return startAddress_ < other.startAddress_;
}
} // namespace DMX

View File

@ -47,6 +47,8 @@ public:
virtual void setPersonality(uint8_t mode);
virtual bool setAddress(uint16_t start);
bool operator< (const Device &other) const;
protected:
std::vector<Personality*> personalities_; //!< available personalities
uint8_t personality_; //!< index of current personality