20using EnumMap = std::map<int64_t, std::string>;
41 [[nodiscard]] std::string
Name()
const;
44 void Filename(
const std::string& filename) { filename_ = filename;}
46 [[nodiscard]] std::string
Filename()
const {
return filename_;};
66 void Version(
const std::string& version) { version_ = version; }
68 [[nodiscard]]
const std::string&
Version()
const {
72 void Comment(
const std::string& comment) {
76 [[nodiscard]]
const std::string&
Comment()
const {
return comment_; }
81 [[nodiscard]]
const Node*
GetNode(
const std::string& name)
const;
86 void J1939(
bool j1939) {j1939_ = j1939;}
88 [[nodiscard]]
bool J1939()
const {
return j1939_;}
107 const std::string& signal_name);
110 const std::string& signal_name)
const;
113 const std::string& signal_name)
const;
116 const std::string& signal_name)
const;
120 const std::string& name)
const;
123 const std::string& name)
const;
126 [[nodiscard]]
const std::map<std::string, EnvVar>&
EnvVars()
const {
127 return env_var_list_;
132 return message_list_;
136 [[nodiscard]]
const std::map<std::string, Node>&
Nodes()
const {
142 return signal_group_list_;
146 [[nodiscard]]
const std::map<std::string, EnumMap>&
Enums()
const {
147 return value_table_list_;
151 [[nodiscard]]
const std::vector<Attribute>&
Attributes()
const {
152 return attribute_list_;
179 std::string filename_;
180 std::string version_;
181 std::string comment_;
182 std::map<std::string, EnvVar> env_var_list_;
183 uint64_t last_message_id_ = 0;
187 std::map<std::string, Attribute> definition_list_;
188 std::vector<Attribute> attribute_list_;
190 using NodeList = std::map<std::string, Node>;
194 std::map<std::string, EnumMap> value_table_list_;
195 std::vector<SignalGroup> signal_group_list_;
All DBC network objects may have attributes attached to them.
Support class for handling attributes of network objects.
Definition: attribute.h:49
Wrapper around an environment DBC variable.
Definition: envvar.h:34
DBC message configuration object.
Definition: message.h:22
Interface against a DBC network configuration.
Definition: network.h:39
std::string ProtocolAsString() const
Returns the network protocol as text.
const Attribute * GetAttribute(const std::string &name) const
Returns an attribute by its name.
const Node * GetNode(const std::string &name) const
Returns the node by its name.
Attribute & CreateDefinition(const std::string &name)
Parser function that creates a definition.
const SignalGroup * GetSignalGroupByName(const std::string &name) const
Returns a signal group by its group name.
ProtocolType Protocol() const
Returns what type of protocol the bus is using.
const Signal * GetSignalByName(const std::string &signal_name) const
Returns a signal by its name.
void Protocol(ProtocolType type)
Sets the protocol type. Should be included in the file but sometimes is missing.
const std::map< std::string, EnvVar > & EnvVars() const
Returns the list of environment variables.
Definition: network.h:126
const MessageList & Messages() const
Returns the list of messages.
Definition: network.h:131
const Message * GetMessageByName(const std::string &name) const
Returns a message object by its name.
bool J1939() const
Returns true if this is a J1939 bus.
Definition: network.h:88
Attribute & CreateAttribute(const Attribute &definition)
Parser function that creates an attribute.
Message * GetMessageByCanId(uint64_t can_id)
Returns a message object by its CAN ID.
Node * GetNode(const std::string &name)
Returns the node by its name.
void Bus(BusType type)
Sets the type of bus.
Message * GetMessageByPgn(uint32_t pgn)
Returns a message object by its PGN.
EnvVar & GetEnvVar(const std::string &name)
Parser function that gets/creates an environment variable.
Message & CreateMessage(uint64_t message_id)
Parser function that creates a message.
void Filename(const std::string &filename)
Sets the file name.
Definition: network.h:44
const Signal * GetSignalByCanId(uint64_t can_id, const std::string &signal_name) const
Returns a signal by its CAN ID and signal name.
Message * GetMessage(uint64_t message_id)
Returns a message object by its message ID.
Signal * GetSignal(uint64_t message_id, const std::string &signal_name)
Returns a signal by its message ID and signal name.
const std::string & Version() const
Returns the DBC file version.
Definition: network.h:68
const std::vector< SignalGroup > & SignalGroups() const
Returns the list of signal groups.
Definition: network.h:141
void Comment(const std::string &comment)
Sets the descriptive text for the DBC file.
Definition: network.h:72
const std::string & Comment() const
Returns the desciptive text.
Definition: network.h:76
void AddSignalGroup(const SignalGroup &group)
Adds a signal group.
BusType Bus() const
Returns the type of bus.
const Signal * GetSignal(uint64_t message_id, const std::string &signal_name) const
Returns a signal by its message ID and signal name.
const Message * GetMessage(uint64_t message_id) const
Returns a message object by its message ID.
std::string BusAsString() const
Returns the type of bus as text.
const std::map< std::string, Node > & Nodes() const
Returns the list of Nodes.
Definition: network.h:136
Message * LastMessage()
Returns the last message.
void AddValueTable(const std::string &name, const EnumMap &list)
Adds a enumerate.
const Node * GetNodeBySource(uint8_t source) const
Returns the node by its source number.
std::string Name() const
Network name.
std::string Filename() const
Returns the file name.
Definition: network.h:46
const SignalGroup * GetSignalGroup(uint64_t message_id, const std::string &name) const
Returns a signal group by its message ID and group name.
const std::vector< Attribute > & Attributes() const
Returns the list of attributes.
Definition: network.h:151
void Version(const std::string &version)
Sets the DBC (file) version.
Definition: network.h:66
void J1939(bool j1939)
Set to true if this is a J1939 bus.
Definition: network.h:86
const Message * GetMessageByCanId(uint64_t can_id) const
Returns a message object by its CAN ID.
Attribute * GetAttribute(const std::string &name)
Returns an attribute by its name.
Node & CreateNode(const std::string &name)
Parser function that creates a node.
const std::map< std::string, EnumMap > & Enums() const
Returns the list of enumerates.
Definition: network.h:146
Message * GetMessageByPgnAndSource(uint32_t pgn, uint8_t source)
Returns a message object by its PGN and source number.
Interface against a DBC node which normally is an ECU.
Definition: node.h:16
Interface against a signal group.
Definition: signalgroup.h:15
Interface against a DBC signal configuration.
Definition: signal.h:68
Wrapper wrong environment variables.
DBC message configuration object.
Main namespace for the DBC library.
Definition: attribute.h:13
BusType
Type of bus.
Definition: network.h:31
std::map< int64_t, std::string > EnumMap
Enumerate list.
Definition: network.h:20
std::map< uint64_t, Message > MessageList
Sorted message of messages. Message ID is the key.
Definition: network.h:36
ProtocolType
Type of CAN protocol.
Definition: network.h:23
@ StandardCAN
Standard CAN.
Interface against a DBC node (Device(ECU).
Interface against a DBC signal configuration.