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 UnsupportedSignalType
27};
28
31 DbcDiagnosticSeverity severity;
32 DbcDiagnosticCode code;
33 std::string filePath;
34 std::size_t lineNumber;
35 std::string message;
36};
37
41 std::vector<DbcDiagnostic> diagnostics;
44 bool HasErrors() const {
45 for (const DbcDiagnostic &diagnostic: diagnostics) {
46 if (diagnostic.severity == DbcDiagnosticSeverity::Error)
47 return true;
48 }
49 return false;
50 }
51};
52
53#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