simlyfy
This commit is contained in:
1 parent
849ce31e2f
commit
a55d1c58ed
272 files changed
+41866
-261
No files matched your search
+31
-16
@@ -9,6 +9,9 @@
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
* @brief Target scope of an attribute definition or assignment.
|
||||
*/
|
||||
enum class AttributeScope {
|
||||
Database,
|
||||
Node,
|
||||
@@ -17,6 +20,9 @@ enum class AttributeScope {
|
||||
Environment
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief DBC attribute storage type. HEX values use decimal integer syntax.
|
||||
*/
|
||||
enum class AttributeType {
|
||||
Integer,
|
||||
Hex,
|
||||
@@ -25,29 +31,38 @@ enum class AttributeType {
|
||||
Enum
|
||||
};
|
||||
|
||||
/** @brief Typed attribute value; ENUM uses a zero-based integer index. */
|
||||
using AttributeValue = std::variant<std::int64_t, double, std::string>;
|
||||
/** @brief Effective attribute values indexed by definition name. */
|
||||
using AttributeMap = std::map<std::string, AttributeValue>;
|
||||
|
||||
/**
|
||||
* @brief Attribute type, permitted range, and optional default.
|
||||
*/
|
||||
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;
|
||||
AttributeScope scope = AttributeScope::Database; /**< Target scope; database when no scope marker is present. */
|
||||
AttributeType type = AttributeType::String; /**< Type used to validate values. */
|
||||
std::int64_t integerMinimum = 0; /**< Inclusive INT, HEX, or ENUM lower bound. */
|
||||
std::int64_t integerMaximum = 0; /**< Inclusive INT, HEX, or ENUM upper bound. */
|
||||
double minimum = 0.0; /**< Inclusive FLOAT lower bound. */
|
||||
double maximum = 0.0; /**< Inclusive FLOAT upper bound. */
|
||||
std::vector<std::string> enumValues; /**< ENUM labels in index order. */
|
||||
std::optional<AttributeValue> defaultValue; /**< Validated default; empty when not declared. */
|
||||
};
|
||||
|
||||
/** Explicit assignment; defaults remain on definitions. Named nodes/environment
|
||||
* variables are retained without validating declarations, which are not parsed. */
|
||||
/**
|
||||
* @brief 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;
|
||||
std::string name; /**< Attribute definition name. */
|
||||
AttributeScope scope = AttributeScope::Database; /**< Target scope; database when no scope marker is present. */
|
||||
std::uint32_t canId = 0U; /**< Normalized frame ID for frame/signal assignments. */
|
||||
bool isExtended = false; /**< Frame type for frame/signal assignments. */
|
||||
std::string targetName; /**< Signal, node, or environment variable name. */
|
||||
AttributeValue value; /**< Validated explicit value. */
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user