LogViewer
A modern log viewer with AI-assisted analysis (Qt 6)
Loading...
Searching...
No Matches
parser::DltParser Class Reference

#include <DltParser.hpp>

Inheritance diagram for parser::DltParser:
Inheritance graph
Collaboration diagram for parser::DltParser:
Collaboration graph

Public Member Functions

void ParseData (const std::filesystem::path &filepath) override
 Parses data from a file path.
 
void ParseData (std::istream &input) override
 Parses data from an input stream.
 
uint32_t GetCurrentProgress () const override
 Gets the current parsing progress.
 
uint32_t GetTotalProgress () const override
 Gets the total expected progress value.
 
virtual std::vector< std::pair< std::string, std::string > > GetFileMetadata () const
 Ordered key → value pairs read from the file header during the last ParseData() call (see db::EventsContainer::SetFileMetadata).
 
void RegisterObserver (IDataParserObserver *observer)
 Registers an observer to receive parsing notifications.
 
void UnregisterObserver (IDataParserObserver *observer)
 
void NotifyNewEvent (db::LogEvent &&event)
 
void NotifyProgressUpdated ()
 
void NotifyNewEventBatch (std::vector< std::pair< int, db::LogEvent::EventItems > > &&eventBatch)
 

Private Member Functions

util::Result< int, error::Error > ParseStream (std::istream &input)
 

Private Attributes

uint32_t m_currentProgress {0}
 
uint32_t m_totalProgress {0}
 
int m_eventId {0}
 
std::vector< IDataParserObserver * > observers
 

Detailed Description

Parser for AUTOSAR Diagnostic Log and Trace (DLT) binary files (.dlt).

Handles files with and without the 16-byte storage header (DLT\x01 magic). Decodes verbose message payloads (string, integer, float arguments) into human-readable text; non-verbose messages are shown as MsgID + hex dump.

Emitted event fields: timestamp — seconds since trace start (from WTMS header or storage header) level — Fatal | Error | Warn | Info | Debug | Verbose (log messages) type — Log | AppTrace | NwTrace | Control AppID — 4-char application identifier ContextID — 4-char context identifier EcuID — 4-char ECU identifier MsgCtr — 8-bit message counter (wraps at 255) info — decoded payload text

Member Function Documentation

◆ GetCurrentProgress()

uint32_t parser::DltParser::GetCurrentProgress ( ) const
inlineoverridevirtual

Gets the current parsing progress.

Returns
uint32_t Current progress value (meaning depends on implementation)
Note
Progress values should be used with GetTotalProgress() for percentage calculations

Implements parser::IDataParser.

◆ GetFileMetadata()

virtual std::vector< std::pair< std::string, std::string > > parser::IDataParser::GetFileMetadata ( ) const
inlinevirtualinherited

Ordered key → value pairs read from the file header during the last ParseData() call (see db::EventsContainer::SetFileMetadata).

Returns
Empty for formats without a header (the default).

Reimplemented in parser::SapiLogParser.

◆ GetTotalProgress()

uint32_t parser::DltParser::GetTotalProgress ( ) const
inlineoverridevirtual

Gets the total expected progress value.

Returns
uint32_t Maximum progress value when parsing is complete
Note
Return 0 if total progress cannot be determined in advance

Implements parser::IDataParser.

◆ NotifyNewEvent()

void parser::IDataParser::NotifyNewEvent ( db::LogEvent &&  event)
inlineinherited

◆ NotifyNewEventBatch()

void parser::IDataParser::NotifyNewEventBatch ( std::vector< std::pair< int, db::LogEvent::EventItems > > &&  eventBatch)
inlineinherited
Here is the caller graph for this function:

◆ NotifyProgressUpdated()

void parser::IDataParser::NotifyProgressUpdated ( )
inlineinherited
Here is the caller graph for this function:

◆ ParseData() [1/2]

void parser::DltParser::ParseData ( const std::filesystem::path &  filepath)
overridevirtual

Parses data from a file path.

Parameters
filepathThe path to the file to parse
Exceptions
std::runtime_errorif the file cannot be opened or parsed
Note
This method should be implemented by derived classes for file-based parsing

Implements parser::IDataParser.

Here is the call graph for this function:

◆ ParseData() [2/2]

void parser::DltParser::ParseData ( std::istream &  input)
overridevirtual

Parses data from an input stream.

Parameters
inputThe input stream to read data from
Exceptions
std::runtime_errorif the stream cannot be read or parsed
Note
This method enables parsing from various sources (files, network, memory)

Implements parser::IDataParser.

Here is the call graph for this function:

◆ ParseStream()

util::Result< int, error::Error > parser::DltParser::ParseStream ( std::istream &  input)
private

Parse all messages from input. Returns the number of messages emitted on success, or an error if the stream could not be probed (e.g. immediate read failure).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegisterObserver()

void parser::IDataParser::RegisterObserver ( IDataParserObserver *  observer)
inlineinherited

Registers an observer to receive parsing notifications.

Parameters
observerPointer to the observer object
Note
The observer must remain valid until parsing completes or it's unregistered
Duplicate observers are automatically prevented

◆ UnregisterObserver()

void parser::IDataParser::UnregisterObserver ( IDataParserObserver *  observer)
inlineinherited

Member Data Documentation

◆ m_currentProgress

uint32_t parser::DltParser::m_currentProgress {0}
private

◆ m_eventId

int parser::DltParser::m_eventId {0}
private

◆ m_totalProgress

uint32_t parser::DltParser::m_totalProgress {0}
private

◆ observers

std::vector<IDataParserObserver*> parser::IDataParser::observers
privateinherited

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