This commit is contained in:
deeaitch committed 2026-10-20 13:21:43 -04:00
1 parent e555ebb571
commit 849ce31e2f
17 files changed
+675 -35

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
// SPDX-License-Identifier: MIT
#ifndef DBC_ATTRIBUTES_H
#define DBC_ATTRIBUTES_H
#include <cstdint>
#include <map>
#include <optional>
#include <string>
#include <variant>
#include <vector>
enum class AttributeScope {
Database,
Node,
Frame,
Signal,
Environment
};
enum class AttributeType {
Integer,
Hex,
Float,
String,
Enum
};
using AttributeValue = std::variant<std::int64_t, double, std::string>;
using AttributeMap = std::map<std::string, AttributeValue>;
struct AttributeDefinition {
AttributeScope scope = AttributeScope::Database;
AttributeType type = AttributeType::String;
std::int64_t integerMinimum = 0;
std::int64_t integerMaximum = 0;
double minimum = 0.0;
double maximum = 0.0;
std::vector<std::string> enumValues;
std::optional<AttributeValue> defaultValue;
};
/** Explicit assignment; defaults remain on definitions. Named nodes/environment
* variables are retained without validating declarations, which are not parsed. */
struct AttributeAssignment {
std::string name;
AttributeScope scope = AttributeScope::Database;
std::uint32_t canId = 0U;
bool isExtended = false;
std::string targetName;
AttributeValue value;
};
#endif