allow devices to be sorted by startaddress
This commit is contained in:
parent
55a120dfed
commit
6486775626
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue