DBC Framework
DBC parsing and CAN signal decoding framework
Loading...
Searching...
No Matches
DbcParser Class Reference

Minimal DBC parser. More...

#include <dbc_parser.h>

Public Member Functions

DbcDatabase ParseFile (const std::string &filePath) const
 Parse DBC file.
 
DbcParseResult ParseFileWithDiagnostics (const std::string &filePath) const
 Parse with warnings and a structured first error instead of throwing.
 

Detailed Description

Minimal DBC parser.

Supports:

  • BO_
  • SG_
  • CM_ BO_
  • CM_ SG_
  • basic M / mN multiplexing
  • VAL_ signal value descriptions

Reports unsupported statements as warnings, except SG_MUL_VAL_ which is an error. VERSION, NS_, BS_, BU_ and NS_ symbol declarations stay quiet.

Definition at line 33 of file dbc_parser.h.

Member Function Documentation

◆ ParseFile()

DbcDatabase DbcParser::ParseFile ( const std::string &  filePath) const

Parse DBC file.

Parameters
filePathPath to input file.
Returns
Parsed database.
Exceptions
std::runtime_erroron file or parse errors. Line parse errors include the file path and one-based line number. Duplicate normalized CAN IDs of the same frame type and duplicate signal names within a frame are rejected at the repeated definition's line.

Definition at line 31 of file dbc_parser.cpp.

References ParseFileWithDiagnostics().

◆ ParseFileWithDiagnostics()

DbcParseResult DbcParser::ParseFileWithDiagnostics ( const std::string &  filePath) const

Parse with warnings and a structured first error instead of throwing.

Returns
Valid database with diagnostics; empty database on error. File errors use line zero; statement errors use physical one-based lines. Warnings indicate ignored syntax and possible incomplete decoding.

Definition at line 44 of file dbc_parser.cpp.

References DbcStatementDispatcher::Dispatch().

Referenced by ParseFile().


The documentation for this class was generated from the following files: