|
DBC Framework
DBC parsing and CAN signal decoding framework
|
Tree node for later use in model/view or other hierarchy consumers. More...
#include <tree_node.h>
Public Member Functions | |
| TreeNode () | |
| Create root node. | |
| TreeNode (const FrameInfo &frame) | |
| Create frame node. | |
| TreeNode (const SignalInfo &signal) | |
| Create signal node. | |
| TreeNode (const TreeNode &)=delete | |
| TreeNode & | operator= (const TreeNode &)=delete |
| TreeNode (TreeNode &&)=delete | |
| TreeNode & | operator= (TreeNode &&)=delete |
| void | AddChild (std::unique_ptr< TreeNode > &&child) |
| Add child node. | |
| const TreeNode * | GetParent () const |
| std::size_t | GetRow () const |
| std::optional< FrameKey > | GetFrameKey () const |
| std::optional< SignalKey > | GetSignalKey () const |
| std::size_t | GetChildCount () const |
| Get child count. | |
| const TreeNode * | GetChild (std::size_t index) const |
| Get child by index. | |
| TreeNode * | GetChild (std::size_t index) |
| Get mutable child by index. | |
| NodeType | GetType () const |
| Get node type. | |
| const std::string & | GetName () const |
| Get display name. | |
| const FrameInfo * | GetFrame () const |
| Get frame payload if node is frame. | |
| const SignalInfo * | GetSignal () const |
| Get signal payload if node is signal. | |
Tree node for later use in model/view or other hierarchy consumers.
Definition at line 37 of file tree_node.h.
| TreeNode::TreeNode | ( | ) |
Create root node.
Definition at line 15 of file tree_node.cpp.
|
explicit |
|
explicit |
| void TreeNode::AddChild | ( | std::unique_ptr< TreeNode > && | child | ) |
Add child node.
| child | Child node to add. A null child is ignored. Existing children keep their addresses and rows. Ownership must be exclusive; attached nodes cannot be reparented. |
| std::invalid_argument | for self/ancestor insertion or an attached child. Rejected ownership remains with the caller. |
Definition at line 27 of file tree_node.cpp.
| const TreeNode * TreeNode::GetParent | ( | ) | const |
Non-owning parent; nullptr for a detached node or the root.
Definition at line 75 of file tree_node.cpp.
Referenced by DbcTreeModel::parent().
| std::size_t TreeNode::GetRow | ( | ) | const |
Zero-based sibling position; zero for a detached node or the root.
Definition at line 79 of file tree_node.cpp.
Referenced by DbcTreeModel::parent().
| std::optional< FrameKey > TreeNode::GetFrameKey | ( | ) | const |
Frame identity for frame nodes and signals attached to a frame; otherwise empty.
Definition at line 83 of file tree_node.cpp.
References GetFrameKey(), and GetType().
Referenced by GetFrameKey(), and GetSignalKey().
| std::optional< SignalKey > TreeNode::GetSignalKey | ( | ) | const |
Signal identity (owning frame key and name); empty for other/detached nodes.
Definition at line 91 of file tree_node.cpp.
References GetFrameKey().
| std::size_t TreeNode::GetChildCount | ( | ) | const |
Get child count.
Definition at line 41 of file tree_node.cpp.
Referenced by DbcTreeModel::rowCount().
| const TreeNode * TreeNode::GetChild | ( | std::size_t | index | ) | const |
Get child by index.
| index | Child index. |
Definition at line 45 of file tree_node.cpp.
Referenced by DbcTreeModel::index().
| TreeNode * TreeNode::GetChild | ( | std::size_t | index | ) |
Get mutable child by index.
| index | Child index. |
Definition at line 52 of file tree_node.cpp.
| NodeType TreeNode::GetType | ( | ) | const |
Get node type.
Definition at line 59 of file tree_node.cpp.
Referenced by DbcTreeModel::data(), and GetFrameKey().
| const std::string & TreeNode::GetName | ( | ) | const |
Get display name.
Definition at line 63 of file tree_node.cpp.
Referenced by DbcTreeModel::data().
| const FrameInfo * TreeNode::GetFrame | ( | ) | const |
Get frame payload if node is frame.
Definition at line 67 of file tree_node.cpp.
Referenced by DbcTreeModel::data().
| const SignalInfo * TreeNode::GetSignal | ( | ) | const |
Get signal payload if node is signal.
Definition at line 71 of file tree_node.cpp.
Referenced by DbcTreeModel::data().