|
3 | 3 | #define __DBC_HPP__ |
4 | 4 |
|
5 | 5 | #include <libdbc/exceptions/error.hpp> |
6 | | -#include <libdbc/utils/utils.hpp> |
7 | | -#include <libdbc/signal.hpp> |
8 | 6 | #include <libdbc/message.hpp> |
| 7 | +#include <libdbc/signal.hpp> |
| 8 | +#include <libdbc/utils/utils.hpp> |
9 | 9 |
|
10 | 10 | #include <regex> |
11 | 11 |
|
12 | 12 | namespace libdbc { |
13 | 13 |
|
14 | | - class Parser { |
15 | | - public: |
16 | | - virtual ~Parser() = default; |
17 | | - |
18 | | - virtual void parse_file(const std::string& file) = 0; |
19 | | - |
20 | | - protected: |
21 | | - |
| 14 | +class Parser { |
| 15 | +public: |
| 16 | + virtual ~Parser() = default; |
22 | 17 |
|
23 | | - }; |
| 18 | + virtual void parse_file(const std::string& file) = 0; |
24 | 19 |
|
25 | | - class DbcParser : public Parser { |
26 | | - public: |
27 | | - DbcParser(); |
| 20 | +protected: |
| 21 | +}; |
28 | 22 |
|
29 | | - virtual ~DbcParser() = default; |
| 23 | +class DbcParser : public Parser { |
| 24 | +public: |
| 25 | + DbcParser(); |
30 | 26 |
|
31 | | - virtual void parse_file(const std::string& file) final override; |
| 27 | + virtual ~DbcParser() = default; |
32 | 28 |
|
33 | | - std::string get_version() const; |
34 | | - std::vector<std::string> get_nodes() const; |
35 | | - std::vector<libdbc::Message> get_messages() const; |
| 29 | + virtual void parse_file(const std::string& file) final override; |
36 | 30 |
|
37 | | - Message::ParseSignalsStatus parseMessage(const uint32_t id, const std::vector<uint8_t>& data, std::vector<double>& out_values); |
| 31 | + std::string get_version() const; |
| 32 | + std::vector<std::string> get_nodes() const; |
| 33 | + std::vector<libdbc::Message> get_messages() const; |
38 | 34 |
|
39 | | - private: |
40 | | - std::string version; |
41 | | - std::vector<std::string> nodes; |
42 | | - std::vector<libdbc::Message> messages; |
| 35 | + Message::ParseSignalsStatus parseMessage(const uint32_t id, const std::vector<uint8_t>& data, std::vector<double>& out_values); |
43 | 36 |
|
44 | | - const std::regex version_re; |
45 | | - const std::regex bit_timing_re; |
46 | | - const std::regex name_space_re; |
47 | | - const std::regex node_re; |
48 | | - const std::regex message_re; |
49 | | - const std::regex signal_re; |
| 37 | +private: |
| 38 | + std::string version; |
| 39 | + std::vector<std::string> nodes; |
| 40 | + std::vector<libdbc::Message> messages; |
50 | 41 |
|
51 | | - void parse_dbc_header(std::istream& file_stream); |
52 | | - void parse_dbc_nodes(std::istream& file_stream); |
53 | | - void parse_dbc_messages(const std::vector<std::string>& lines); |
| 42 | + const std::regex version_re; |
| 43 | + const std::regex bit_timing_re; |
| 44 | + const std::regex name_space_re; |
| 45 | + const std::regex node_re; |
| 46 | + const std::regex message_re; |
| 47 | + const std::regex signal_re; |
54 | 48 |
|
55 | | - }; |
| 49 | + void parse_dbc_header(std::istream& file_stream); |
| 50 | + void parse_dbc_nodes(std::istream& file_stream); |
| 51 | + void parse_dbc_messages(const std::vector<std::string>& lines); |
| 52 | +}; |
56 | 53 |
|
57 | 54 | } |
58 | 55 |
|
|
0 commit comments