Skip to content

Commit 38425b9

Browse files
author
Scott
committed
Count signal values in example DBC read
1 parent 7b1b08c commit 38425b9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

examples/read_dbc.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ int main(int argc, char ** argv)
4545
size_t message_attr_counter = 0;
4646
size_t signal_attr_counter = 0;
4747
size_t attr_def_default_counter = 0;
48+
size_t signal_value_counter = 0;
4849

4950
auto bus_nodes = dbc.getBusNodes();
5051
auto messages = dbc.getMessages();
@@ -69,6 +70,10 @@ int main(int argc, char ** argv)
6970
if (sig.second->getComment() != nullptr) {
7071
signal_comment_counter++;
7172
}
73+
const int num_values = sig.second->getValueDescriptions().size();
74+
if (num_values != 0){
75+
signal_value_counter += num_values;
76+
}
7277
}
7378
}
7479

@@ -115,6 +120,7 @@ int main(int argc, char ** argv)
115120
std::cout << "Found " << bus_nodes.size() << " bus nodes.\n";
116121
std::cout << "Found " << dbc.getMessages().size() << " messages.\n";
117122
std::cout << "Found " << signal_counter << " signals.\n";
123+
std::cout << "Found " << signal_value_counter << " signal values.\n";
118124

119125
size_t total_comments = bus_node_comment_counter + message_comment_counter + signal_comment_counter;
120126

0 commit comments

Comments
 (0)