DBC framework
dbc_tree_builder.cpp
Go to the documentation of this file.
1/**
2 * @file dbc_tree_builder.cpp
3 * @brief
4 *
5 * Created: 2026-03-13
6 * Author: Deeaitch (Dim. Himro)
7 *
8 * Licensed under the MIT License.
9 * See LICENSE file in the project root for full license text.
10 */
11
12#include "dbc_tree_builder.h"
13
14std::unique_ptr<TreeNode> DbcTreeBuilder::Build (const DbcDatabase &database) const {
15 std::unique_ptr<TreeNode> root (new TreeNode());
16
17 for (std::size_t frameIndex = 0U; frameIndex < database.frames.size(); ++frameIndex) {
18 const FrameInfo &frame = database.frames[frameIndex];
19 std::unique_ptr<TreeNode> frameNode (new TreeNode (frame));
20
21 for (std::size_t signalIndex = 0U; signalIndex < frame.signals.size(); ++signalIndex) {
22 const SignalInfo &signal = frame.signals[signalIndex];
23 std::unique_ptr<TreeNode> signalNode (new TreeNode (signal));
24 frameNode->AddChild (std::move (signalNode));
25 }
26
27 root->AddChild (std::move (frameNode));
28 }
29
30 return root;
31}
std::unique_ptr< TreeNode > Build(const DbcDatabase &database) const
Build tree representation of parsed DBC data.
Tree node for later use in model/view or other hierarchy consumers.
Definition: tree_node.h:35
Created: 2026-03-13 Author: Deeaitch (Dim. Himro)
Parsed DBC content stored in a simple internal form.
Definition: dbc_database.h:22
std::vector< FrameInfo > frames
Definition: dbc_database.h:23
Describes one CAN frame from a DBC file.
Definition: frame_info.h:24
std::vector< SignalInfo > signals
Definition: frame_info.h:33
Describes one signal inside a DBC frame.
Definition: signal_info.h:22