Branch data Line data Source code
1 : : /**
2 : : * @file dbc_tree_builder.cpp
3 : : * @brief Construction of frame and signal metadata trees.
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 : :
14 : 22 : std::unique_ptr<TreeNode> DbcTreeBuilder::Build(const DbcDatabase &database) const {
15 : 22 : std::unique_ptr<TreeNode> root = std::make_unique<TreeNode>();
16 : :
17 [ + + ]: 53 : for (const FrameInfo &frame : database.frames) {
18 [ + - ]: 31 : std::unique_ptr<TreeNode> frameNode = std::make_unique<TreeNode>(frame);
19 : :
20 [ + + ]: 75 : for (const SignalInfo &signal : frame.signals) {
21 [ + - ]: 44 : std::unique_ptr<TreeNode> signalNode = std::make_unique<TreeNode>(signal);
22 [ + - ]: 44 : frameNode->AddChild(std::move(signalNode));
23 : 44 : }
24 : :
25 [ + - ]: 31 : root->AddChild(std::move(frameNode));
26 : 31 : }
27 : :
28 : 22 : return root;
29 : 0 : }
|