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

Immutable runtime snapshot. Copies share storage; reload replaces a snapshot. Owning lookup handles and decoded results keep old definitions alive. More...

#include <decode_database.h>

Public Member Functions

 DecodeDatabase (const std::vector< DecodeFrame > &frames)
 
const std::vector< DecodeFrame > & GetFrames () const
 
std::shared_ptr< const DecodeFrame > FindFrame (const FrameKey &key) const
 
PgnLookupResult FindFrameByPgn (std::uint32_t pgn) const
 
std::shared_ptr< const DecodeSignal > FindSignal (const SignalKey &key) const
 Return an owning signal handle, or an empty handle for a missing key.
 

Detailed Description

Immutable runtime snapshot. Copies share storage; reload replaces a snapshot. Owning lookup handles and decoded results keep old definitions alive.

Definition at line 101 of file decode_database.h.

Constructor & Destructor Documentation

◆ DecodeDatabase()

DecodeDatabase::DecodeDatabase ( const std::vector< DecodeFrame > &  frames)
explicit

Copy and validate definitions before building the frame index. Input aliases cannot modify the snapshot, even for rvalue input.

Exceptions
std::invalid_argumentfor invalid metadata or duplicate keys.

Definition at line 111 of file decode_database.cpp.

Member Function Documentation

◆ GetFrames()

const std::vector< DecodeFrame > & DecodeDatabase::GetFrames ( ) const

Borrowed view, valid while this snapshot remains alive and unchanged.

Definition at line 115 of file decode_database.cpp.

Referenced by main().

◆ FindFrame()

std::shared_ptr< const DecodeFrame > DecodeDatabase::FindFrame ( const FrameKey &  key) const

Owning handles retain the entire snapshot across reload or destruction.

Definition at line 120 of file decode_database.cpp.

Referenced by FindSignal().

◆ FindFrameByPgn()

PgnLookupResult DecodeDatabase::FindFrameByPgn ( std::uint32_t  pgn) const

Only explicitly marked hasPgn frames participate; ambiguous results have no definition.

Definition at line 130 of file decode_database.cpp.

References PgnLookupResult::ambiguous, and PgnLookupResult::definition.

◆ FindSignal()

std::shared_ptr< const DecodeSignal > DecodeDatabase::FindSignal ( const SignalKey &  key) const

Return an owning signal handle, or an empty handle for a missing key.

Definition at line 146 of file decode_database.cpp.

References FindFrame(), SignalKey::frame, DecodeSignal::name, and SignalKey::name.


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