This commit is contained in:
deeaitch committed 2026-10-20 13:38:21 -04:00
1 parent 849ce31e2f
commit a55d1c58ed
272 files changed
+41866 -261

No files matched your search

+11 -4
View File
@@ -13,15 +13,17 @@
* @brief Stable frame identifier: normalized CAN ID and frame type.
*/
struct FrameKey {
std::uint32_t canId = 0U;
bool isExtended = false;
std::uint32_t canId = 0U; /**< Normalized CAN identifier. */
bool isExtended = false; /**< True for extended CAN frames. */
FrameKey() = default;
/** @brief Create a key from a normalized identifier and frame type. */
FrameKey(std::uint32_t id, bool extended)
: canId(id), isExtended(extended) {
}
/** @brief Compare all logical identity fields. */
bool operator==(const FrameKey &other) const {
return (canId == other.canId) && (isExtended == other.isExtended);
}
@@ -31,6 +33,7 @@ struct FrameKey {
* @brief Hasher for frame key.
*/
struct FrameKeyHasher {
/** @brief Hash the logical identity fields. */
std::size_t operator()(const FrameKey &key) const {
const std::size_t a = static_cast<std::size_t>(key.canId);
const std::size_t b = key.isExtended ? 1U : 0U;
@@ -40,20 +43,24 @@ struct FrameKeyHasher {
/** Stable signal identifier within one logical DBC database. */
struct SignalKey {
FrameKey frame;
std::string name;
FrameKey frame; /**< Owning frame identity. */
std::string name; /**< Signal name within the frame. */
SignalKey() = default;
/** @brief Create a signal key from its frame identity and name. */
SignalKey(FrameKey frameKey, std::string signalName)
: frame(frameKey), name(std::move(signalName)) {
}
/** @brief Compare all logical identity fields. */
bool operator==(const SignalKey &other) const {
return frame == other.frame && name == other.name;
}
};
/** @brief Hasher for stable signal keys. */
struct SignalKeyHasher {
/** @brief Hash the logical identity fields. */
std::size_t operator()(const SignalKey &key) const {
return FrameKeyHasher()(key.frame) ^ (std::hash<std::string>()(key.name) << 1U);
}