Skip to content

Commit a14be82

Browse files
committed
Ability to print signals now added
Help test case output display what is missing.
1 parent ed41141 commit a14be82

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

include/dbc.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ namespace libdbc {
4545

4646

4747
std::ostream& operator<< (std::ostream &out, const Message& msg);
48+
std::ostream& operator<< (std::ostream &out, const Signal& sig);
4849

4950

5051
class Parser {

src/dbc.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ namespace libdbc {
3535
}
3636

3737

38+
std::ostream& operator<< (std::ostream &out, const Signal& sig) {
39+
out << "Signal {name: " << sig.name << ", ";
40+
out << "Multiplexed: " << (sig.is_multiplexed ? "True" : "False") << ", ";
41+
out << "Start bit: " << sig.start_bit << ", ";
42+
out << "Size: " << sig.size << ", ";
43+
out << "Endianness: " << (sig.is_bigendian ? "Big endian" : "Little endian") << ", ";
44+
out << "Value Type: " << (sig.is_signed ? "Signed" : "Unsigned") << ", ";
45+
out << "Min: " << sig.min << ", Max: " << sig.max << ", ";
46+
out << "Unit: (" << sig.unit << "), ";
47+
out << "receivers: ";
48+
for(const auto &r : sig.receivers)
49+
out << r;
50+
return out << "}";
51+
}
52+
3853

3954
DbcParser::DbcParser() : version(""), nodes(),
4055
version_re("^(VERSION)\\s\"(.*)\""), bit_timing_re("^(BS_:)"),

0 commit comments

Comments
 (0)