DbcLib 1.0
CAN DBC C++ library.
Loading...
Searching...
No Matches
node.h
Go to the documentation of this file.
1/*
2* Copyright 2022 Ingemar Hedvall
3* SPDX-License-Identifier: MIT
4 */
8#pragma once
9#include <string>
10#include <vector>
11#include "dbc/attribute.h"
12namespace dbc {
16class Node {
17 public:
19 void Name(const std::string& name) { name_ = name; }
21 [[nodiscard]] const std::string& Name() const {
22 return name_;
23 }
24
26 void Source(uint8_t source) {source_ = source;};
28 [[nodiscard]] uint8_t Source() const;
29
31 void Comment(const std::string& comment) { comment_ = comment; }
33 [[nodiscard]] const std::string& Comment() const { return comment_; }
34
36 [[nodiscard]] const std::vector<Attribute>& Attributes() const {
37 return attribute_list_;
38 }
40 Attribute& CreateAttribute(const Attribute& definition);
42 const Attribute* GetAttribute(const std::string& name) const;
43
44 private:
45 std::string name_;
46 std::string comment_;
47 std::vector<Attribute> attribute_list_;
48 uint8_t source_ = 254;
49};
50
51} // namespace dbc
All DBC network objects may have attributes attached to them.
Support class for handling attributes of network objects.
Definition: attribute.h:49
Interface against a DBC node which normally is an ECU.
Definition: node.h:16
const std::vector< Attribute > & Attributes() const
Returns the attribute list.
Definition: node.h:36
const std::string & Comment() const
Returns the descriptive text.
Definition: node.h:33
Attribute & CreateAttribute(const Attribute &definition)
Creates an attribute. Parser function.
void Comment(const std::string &comment)
Sets the descriptive text.
Definition: node.h:31
const std::string & Name() const
Returns the name.
Definition: node.h:21
const Attribute * GetAttribute(const std::string &name) const
Returns an attribute by its name.
void Source(uint8_t source)
Source number is used in J1939 and is included in the CAN ID.
Definition: node.h:26
uint8_t Source() const
Source number (J1939).
void Name(const std::string &name)
Sets the name.
Definition: node.h:19
Main namespace for the DBC library.
Definition: attribute.h:13