DBC Framework
DBC parsing and CAN signal decoding framework
Loading...
Searching...
No Matches
dbc_diagnostic.h
1// SPDX-License-Identifier: MIT
2#ifndef DBC_DIAGNOSTIC_H
3#define DBC_DIAGNOSTIC_H
4
5#include "dbc_database.h"
6#include <cstddef>
7#include <string>
8#include <vector>
9
11enum class DbcDiagnosticSeverity {
12 Warning,
13 Error
14};
15
17enum class DbcDiagnosticCode {
18 FileOpenError,
19 FileReadError,
20 InvalidStatement,
21 InvalidValueDescription,
22 InvalidMultiplexing,
23 UnsupportedStatement,
24 InvalidAttribute,
25 UnsupportedAttribute
26};
27
30 DbcDiagnosticSeverity severity;
31 DbcDiagnosticCode code;
32 std::string filePath;
33 std::size_t lineNumber;
34 std::string message;
35};
36
40 std::vector<DbcDiagnostic> diagnostics;
43 bool HasErrors() const {
44 for (const DbcDiagnostic &diagnostic: diagnostics) {
45 if (diagnostic.severity == DbcDiagnosticSeverity::Error)
46 return true;
47 }
48 return false;
49 }
50};
51
52#endif /* DBC_DIAGNOSTIC_H */
Parsed DBC database and attribute metadata.
Parsed DBC content stored in a simple internal form.
Diagnostic message and physical source location.
std::string message
DbcDiagnosticSeverity severity
DbcDiagnosticCode code
std::string filePath
std::size_t lineNumber
Parsed database and diagnostics; the database is empty on error.
std::vector< DbcDiagnostic > diagnostics
bool HasErrors() const
Return whether any diagnostic has error severity.
DbcDatabase database