Skip to content

Commit 55ff2d2

Browse files
committed
implement < operator for signal to be able to sort them
1 parent 8895220 commit 55ff2d2

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

include/libdbc/signal.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace libdbc {
2525
explicit Signal(std::string name, bool is_multiplexed, uint32_t start_bit, uint32_t size, bool is_bigendian, bool is_signed, double factor, double offset, double min, double max, std::string unit, std::vector<std::string> recievers);
2626

2727
virtual bool operator==(const Signal& rhs) const;
28+
bool operator< (const Signal& rhs) const;
2829
};
2930

3031
std::ostream& operator<< (std::ostream &out, const Signal& sig);

src/signal.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ namespace libdbc {
1212
(this->unit == rhs.unit) && (this->receivers == rhs.receivers);
1313
}
1414

15+
bool Signal::operator< (const Signal& rhs) const {
16+
return start_bit < rhs.start_bit;
17+
}
1518

1619
std::ostream& operator<< (std::ostream &out, const Signal& sig) {
1720
out << "Signal {name: " << sig.name << ", ";

0 commit comments

Comments
 (0)