6#include <unordered_set>
9DecodeDatabase::Storage::Storage(std::vector<DecodeFrame> definitions)
10 : frames(std::move(definitions)) {
11 frameIndexByKey.reserve(frames.size());
12 for (std::size_t index = 0U; index < frames.size(); ++index) {
14 if (!frameIndexByKey.emplace(frame.GetKey(), index).second)
15 throw std::invalid_argument(
"Duplicate runtime frame key");
16 std::unordered_set<std::string> names;
18 if (!names.insert(signal.name).second)
19 throw std::invalid_argument(
"Duplicate runtime signal key");
24DecodeDatabase::DecodeDatabase(std::vector<DecodeFrame> frames)
25 : storage(std::make_shared<const Storage>(std::move(frames))) {
29 static const std::vector<DecodeFrame> empty;
30 return storage ? storage->frames : empty;
36 const std::unordered_map<FrameKey, std::size_t, FrameKeyHasher>::const_iterator it =
37 storage->frameIndexByKey.find(key);
38 if (it == storage->frameIndexByKey.end())
40 return std::shared_ptr<const DecodeFrame>(storage, &storage->frames[it->second]);
43std::shared_ptr<const DecodeSignal> DecodeDatabase::FindSignal(
const SignalKey &key)
const {
44 const std::shared_ptr<const DecodeFrame> frame =
FindFrame(key.frame);
48 if (signal.name == key.name)
49 return std::shared_ptr<const DecodeSignal>(frame, &signal);
std::shared_ptr< const DecodeFrame > FindFrame(const FrameKey &key) const
const std::vector< DecodeFrame > & GetFrames() const
Created: 2026-03-13 Author: Deeaitch (Dim. Himro)
Runtime-ready frame definition.
Runtime-ready signal definition.
Stable frame identifier: normalized CAN ID and frame type.