-
Notifications
You must be signed in to change notification settings - Fork 37
/
main.cpp
53 lines (46 loc) · 1.57 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* main.cpp
*
* Created on: 04.10.2013
* Author: downtimes
*/
#include <iostream>
#include <stdexcept>
#include "header/dbciterator.hpp"
const std::string usage = ""
"This parser is meant to be used via CLI at the moment\n"
" ./parser <FILE>\n"
" \n"
"example:\n"
" ./parser /home/downtimes/kit13.dbc\n";
int main(int argc, char* argv[]) {
if (argc < 2) {
std::cout << usage << std::endl;
return 0;
}
try {
DBCIterator dbc(argv[1]);
for(auto message : dbc) {
std::cout << message.getName() << " " << message.getId() << std::endl;
for(auto sig : message) {
std::cout << "Signal: " << sig.getName() << " ";
std::cout << "To: ";
for (auto to : sig.getTo()) {
std::cout << to << ", ";
}
std::cout << sig.getStartbit() << "," << sig.getLength() << std::endl;
std::cout << "(" << sig.getFactor() << ", " << sig.getOffset() << ")" << std::endl;
std::cout << "[" << sig.getMinimum() << "," << sig.getMaximum() << "]" << std::endl;
if (sig.getMultiplexor() == Multiplexor::MULTIPLEXED) {
std::cout << "#" << sig.getMultiplexedNumber() << "#" << std::endl;
} else if (sig.getMultiplexor() == Multiplexor::MULTIPLEXOR) {
std::cout << "+Multiplexor+" << std::endl;
}
std::cout << std::endl;
};
}
} catch (std::invalid_argument& ex) {
std::cout << ex.what() << std::endl;
}
// return 0;
}