DBC Framework
DBC parsing and CAN signal decoding framework
Loading...
Searching...
No Matches
attributes.h
1// SPDX-License-Identifier: MIT
2#ifndef DBC_ATTRIBUTES_H
3#define DBC_ATTRIBUTES_H
4
5#include <cstdint>
6#include <map>
7#include <optional>
8#include <string>
9#include <variant>
10#include <vector>
11
15enum class AttributeScope {
16 Database,
17 Node,
18 Frame,
19 Signal,
20 Environment
21};
22
26enum class AttributeType {
27 Integer,
28 Hex,
29 Float,
30 String,
31 Enum
32};
33
35using AttributeValue = std::variant<std::int64_t, double, std::string>;
37using AttributeMap = std::map<std::string, AttributeValue>;
38
43 AttributeScope scope = AttributeScope::Database;
44 AttributeType type = AttributeType::String;
45 std::int64_t integerMinimum = 0;
46 std::int64_t integerMaximum = 0;
47 double minimum = 0.0;
48 double maximum = 0.0;
49 std::vector<std::string> enumValues;
50 std::optional<AttributeValue> defaultValue;
51};
52
60 std::string name;
61 AttributeScope scope = AttributeScope::Database;
62 std::uint32_t canId = 0U;
63 bool isExtended = false;
64 std::string targetName;
65 AttributeValue value;
66};
67
68#endif
Explicit assignment; defaults remain on definitions.
Definition attributes.h:59
std::uint32_t canId
Definition attributes.h:62
std::string targetName
Definition attributes.h:64
AttributeScope scope
Definition attributes.h:61
AttributeValue value
Definition attributes.h:65
std::string name
Definition attributes.h:60
Attribute type, permitted range, and optional default.
Definition attributes.h:42
std::vector< std::string > enumValues
Definition attributes.h:49
std::int64_t integerMaximum
Definition attributes.h:46
AttributeType type
Definition attributes.h:44
AttributeScope scope
Definition attributes.h:43
std::int64_t integerMinimum
Definition attributes.h:45
std::optional< AttributeValue > defaultValue
Definition attributes.h:50