INSTINCT Code Coverage Report


Directory: src/
File: internal/NodeManager.cpp
Date: 2025-02-07 16:54:41
Exec Total Coverage
Lines: 159 188 84.6%
Functions: 27 31 87.1%
Branches: 154 264 58.3%

Line Branch Exec Source
1 // This file is part of INSTINCT, the INS Toolkit for Integrated
2 // Navigation Concepts and Training by the Institute of Navigation of
3 // the University of Stuttgart, Germany.
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9 #include "internal/NodeManager.hpp"
10
11 #include "internal/Node/Node.hpp"
12 #include "internal/Node/Pin.hpp"
13
14 #include "internal/FlowManager.hpp"
15
16 #include "util/Assert.h"
17
18 #include <algorithm>
19 #include <thread>
20 #include <deque>
21
22 #include "NodeRegistry.hpp"
23
24 namespace NAV::NodeManager
25 {
26 /* -------------------------------------------------------------------------------------------------------- */
27 /* Private Members */
28 /* -------------------------------------------------------------------------------------------------------- */
29
30 namespace
31 {
32 std::vector<NAV::Node*> m_nodes;
33 size_t m_NextId = 1;
34
35 } // namespace
36
37 /* -------------------------------------------------------------------------------------------------------- */
38 /* Public Members */
39 /* -------------------------------------------------------------------------------------------------------- */
40
41 #if !defined(WIN32) && !defined(_WIN32) && !defined(__WIN32)
42 bool showFlowWhenInvokingCallbacks = true;
43 bool showFlowWhenNotifyingValueChange = true;
44 #else
45 bool showFlowWhenInvokingCallbacks = false;
46 bool showFlowWhenNotifyingValueChange = false;
47 #endif
48
49 } // namespace NAV::NodeManager
50
51 /* -------------------------------------------------------------------------------------------------------- */
52 /* Function Definitions */
53 /* -------------------------------------------------------------------------------------------------------- */
54
55 1315 const std::vector<NAV::Node*>& NAV::NodeManager::m_Nodes()
56 {
57 1315 return m_nodes;
58 }
59
60 346 void NAV::NodeManager::AddNode(NAV::Node* node)
61 {
62
1/2
✓ Branch 1 taken 346 times.
✗ Branch 2 not taken.
346 if (!node->id)
63 {
64 346 node->id = GetNextNodeId();
65 }
66 346 m_nodes.push_back(node);
67
2/4
✓ Branch 2 taken 346 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 346 times.
✗ Branch 7 not taken.
346 LOG_DEBUG("Creating node: {}", node->nameId());
68
69
2/2
✓ Branch 4 taken 206 times.
✓ Branch 5 taken 346 times.
552 for (auto& pin : node->inputPins)
70 {
71 206 pin.parentNode = node;
72 }
73
2/2
✓ Branch 4 taken 263 times.
✓ Branch 5 taken 346 times.
609 for (auto& pin : node->outputPins)
74 {
75 263 pin.parentNode = node;
76 }
77
78
1/2
✓ Branch 1 taken 346 times.
✗ Branch 2 not taken.
346 m_NextId = std::max(m_NextId, size_t(node->id) + 1);
79
2/2
✓ Branch 4 taken 206 times.
✓ Branch 5 taken 346 times.
552 for (const auto& pin : node->inputPins)
80 {
81
1/2
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
206 m_NextId = std::max(m_NextId, size_t(pin.id) + 1);
82 }
83
2/2
✓ Branch 4 taken 263 times.
✓ Branch 5 taken 346 times.
609 for (const auto& pin : node->outputPins)
84 {
85
1/2
✓ Branch 1 taken 263 times.
✗ Branch 2 not taken.
263 m_NextId = std::max(m_NextId, size_t(pin.id) + 1);
86 }
87
88 346 flow::ApplyChanges();
89 346 }
90
91 346 void NAV::NodeManager::UpdateNode(Node* node)
92 {
93 LOG_TRACE("called for node: {}", node->nameId());
94
2/2
✓ Branch 4 taken 272 times.
✓ Branch 5 taken 346 times.
618 for (auto& pin : node->inputPins)
95 {
96 272 pin.parentNode = node;
97 }
98
2/2
✓ Branch 4 taken 268 times.
✓ Branch 5 taken 346 times.
614 for (auto& pin : node->outputPins)
99 {
100 268 pin.parentNode = node;
101 }
102
103
2/2
✓ Branch 4 taken 272 times.
✓ Branch 5 taken 346 times.
618 for (const auto& pin : node->inputPins)
104 {
105
1/2
✓ Branch 1 taken 272 times.
✗ Branch 2 not taken.
272 m_NextId = std::max(m_NextId, size_t(pin.id) + 1);
106 }
107
2/2
✓ Branch 4 taken 268 times.
✓ Branch 5 taken 346 times.
614 for (const auto& pin : node->outputPins)
108 {
109
1/2
✓ Branch 1 taken 268 times.
✗ Branch 2 not taken.
268 m_NextId = std::max(m_NextId, size_t(pin.id) + 1);
110 }
111 346 }
112
113 344 bool NAV::NodeManager::DeleteNode(ax::NodeEditor::NodeId nodeId)
114 {
115 LOG_TRACE("called for node with id {}", size_t(nodeId));
116
117
1/2
✓ Branch 1 taken 344 times.
✗ Branch 2 not taken.
1397 auto it = std::ranges::find_if(m_nodes, [nodeId](const auto& node) { return node->id == nodeId; });
118
1/2
✓ Branch 2 taken 344 times.
✗ Branch 3 not taken.
344 if (it != m_nodes.end())
119 {
120 344 Node* node = *it;
121
1/2
✓ Branch 2 taken 344 times.
✗ Branch 3 not taken.
344 m_nodes.erase(it);
122
3/6
✓ Branch 1 taken 344 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 344 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 344 times.
✗ Branch 9 not taken.
344 LOG_DEBUG("Deleting node: {}", node->nameId());
123
124
3/4
✓ Branch 1 taken 344 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 338 times.
✓ Branch 4 taken 6 times.
344 if (node->isInitialized())
125 {
126
1/2
✓ Branch 1 taken 338 times.
✗ Branch 2 not taken.
338 node->doDeinitialize(true);
127 }
128
2/2
✓ Branch 5 taken 271 times.
✓ Branch 6 taken 344 times.
615 for (auto& inputPin : node->inputPins)
129 {
130
3/4
✓ Branch 1 taken 271 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 172 times.
✓ Branch 4 taken 99 times.
271 if (inputPin.isPinLinked())
131 {
132
1/2
✓ Branch 1 taken 172 times.
✗ Branch 2 not taken.
172 inputPin.deleteLink();
133 }
134 }
135
2/2
✓ Branch 5 taken 267 times.
✓ Branch 6 taken 344 times.
611 for (auto& outputPin : node->outputPins)
136 {
137
3/4
✓ Branch 1 taken 267 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 73 times.
✓ Branch 4 taken 194 times.
267 if (outputPin.isPinLinked())
138 {
139
1/2
✓ Branch 1 taken 73 times.
✗ Branch 2 not taken.
73 outputPin.deleteLinks();
140 }
141 }
142
143
1/2
✓ Branch 0 taken 344 times.
✗ Branch 1 not taken.
344 delete node; // NOLINT(cppcoreguidelines-owning-memory)
144
145
1/2
✓ Branch 1 taken 344 times.
✗ Branch 2 not taken.
344 flow::ApplyChanges();
146
147 344 return true;
148 }
149
150 return false;
151 }
152
153 223 void NAV::NodeManager::DeleteAllNodes()
154 {
155 LOG_TRACE("called");
156
157 223 bool saveLastActionsValue = NAV::flow::saveLastActions;
158 223 NAV::flow::saveLastActions = false;
159
160
2/2
✓ Branch 1 taken 344 times.
✓ Branch 2 taken 223 times.
567 while (!m_nodes.empty())
161 {
162 344 NodeManager::DeleteNode(m_nodes.back()->id);
163 }
164
165 223 m_NextId = 1;
166
167 223 NAV::flow::saveLastActions = saveLastActionsValue;
168 223 flow::ApplyChanges();
169 223 }
170
171 270 void NAV::NodeManager::AddLink(ax::NodeEditor::LinkId linkId)
172 {
173
1/2
✓ Branch 1 taken 270 times.
✗ Branch 2 not taken.
270 m_NextId = std::max(m_NextId, size_t(linkId) + 1);
174 270 }
175
176 5312 NAV::InputPin* NAV::NodeManager::CreateInputPin(NAV::Node* node, const char* name, NAV::Pin::Type pinType, const std::vector<std::string>& dataIdentifier,
177 InputPin::Callback callback, InputPin::FlowFirableCheckFunc firable, int priority, int idx)
178 {
179 LOG_TRACE("called for pin ({}) of type ({}) for node [{}]", name, std::string(pinType), node->nameId());
180
2/2
✓ Branch 0 taken 5200 times.
✓ Branch 1 taken 112 times.
5312 if (idx < 0)
181 {
182 5200 idx = static_cast<int>(node->inputPins.size());
183 }
184 5312 idx = std::min(idx, static_cast<int>(node->inputPins.size()));
185 5312 auto iter = std::next(node->inputPins.begin(), idx);
186
187
2/4
✓ Branch 1 taken 5312 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 5312 times.
✗ Branch 6 not taken.
5312 node->inputPins.emplace(iter, GetNextPinId(), name, pinType, node);
188
189
1/2
✓ Branch 1 taken 5312 times.
✗ Branch 2 not taken.
5312 node->inputPins.at(static_cast<size_t>(idx)).callback = callback;
190
2/2
✓ Branch 0 taken 372 times.
✓ Branch 1 taken 4940 times.
5312 if (firable != nullptr)
191 {
192
1/2
✓ Branch 1 taken 372 times.
✗ Branch 2 not taken.
372 node->inputPins.at(static_cast<size_t>(idx)).firable = firable;
193 }
194
2/4
✓ Branch 1 taken 5312 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5312 times.
✗ Branch 5 not taken.
5312 node->inputPins.at(static_cast<size_t>(idx)).dataIdentifier = dataIdentifier;
195
1/2
✓ Branch 1 taken 5312 times.
✗ Branch 2 not taken.
5312 node->inputPins.at(static_cast<size_t>(idx)).priority = priority;
196
197
1/2
✓ Branch 1 taken 5312 times.
✗ Branch 2 not taken.
5312 flow::ApplyChanges();
198
199 10624 return &node->inputPins.back();
200 }
201
202 7324 NAV::OutputPin* NAV::NodeManager::CreateOutputPin(NAV::Node* node, const char* name, NAV::Pin::Type pinType, const std::vector<std::string>& dataIdentifier, OutputPin::PinData data, int idx)
203 {
204 LOG_TRACE("called for pin ({}) of type ({}) for node [{}]", name, std::string(pinType), node->nameId());
205
1/2
✓ Branch 0 taken 7324 times.
✗ Branch 1 not taken.
7324 if (idx < 0)
206 {
207 7324 idx = static_cast<int>(node->outputPins.size());
208 }
209 7324 idx = std::min(idx, static_cast<int>(node->outputPins.size()));
210 7324 auto iter = std::next(node->outputPins.begin(), idx);
211
212
2/4
✓ Branch 1 taken 7324 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 7324 times.
✗ Branch 6 not taken.
7324 node->outputPins.emplace(iter, GetNextPinId(), name, pinType, node);
213
214
1/2
✓ Branch 1 taken 7324 times.
✗ Branch 2 not taken.
7324 node->outputPins.at(static_cast<size_t>(idx)).data = data;
215
2/4
✓ Branch 1 taken 7324 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 7324 times.
✗ Branch 5 not taken.
7324 node->outputPins.at(static_cast<size_t>(idx)).dataIdentifier = dataIdentifier;
216
217
1/2
✓ Branch 1 taken 7324 times.
✗ Branch 2 not taken.
7324 flow::ApplyChanges();
218
219 14648 return &node->outputPins.back();
220 }
221
222 bool NAV::NodeManager::DeleteOutputPin(NAV::OutputPin& pin)
223 {
224 LOG_TRACE("called for pin ({})", size_t(pin.id));
225
226 pin.deleteLinks();
227
228 size_t pinIndex = pin.parentNode->outputPinIndexFromId(pin.id);
229 pin.parentNode->outputPins.erase(pin.parentNode->outputPins.begin() + static_cast<int64_t>(pinIndex));
230
231 return true;
232 }
233
234 bool NAV::NodeManager::DeleteInputPin(NAV::InputPin& pin)
235 {
236 LOG_TRACE("called for pin ({})", size_t(pin.id));
237
238 pin.deleteLink();
239
240 size_t pinIndex = pin.parentNode->inputPinIndexFromId(pin.id);
241 pin.parentNode->inputPins.erase(pin.parentNode->inputPins.begin() + static_cast<int64_t>(pinIndex));
242
243 return true;
244 }
245
246 namespace NAV::NodeManager
247 {
248 namespace
249 {
250
251 12983 size_t GetNextId()
252 {
253 12983 return m_NextId++;
254 }
255
256 } // namespace
257 } // namespace NAV::NodeManager
258
259 346 ax::NodeEditor::NodeId NAV::NodeManager::GetNextNodeId()
260 {
261
1/2
✓ Branch 2 taken 346 times.
✗ Branch 3 not taken.
346 return { GetNextId() };
262 }
263
264 1 ax::NodeEditor::LinkId NAV::NodeManager::GetNextLinkId()
265 {
266
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 return { GetNextId() };
267 }
268
269 12636 ax::NodeEditor::PinId NAV::NodeManager::GetNextPinId()
270 {
271
1/2
✓ Branch 2 taken 12636 times.
✗ Branch 3 not taken.
12636 return { GetNextId() };
272 }
273
274 221 NAV::Node* NAV::NodeManager::FindNode(ax::NodeEditor::NodeId id)
275 {
276
1/2
✓ Branch 5 taken 329 times.
✗ Branch 6 not taken.
329 for (auto& node : m_nodes)
277 {
278
3/4
✓ Branch 1 taken 329 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 221 times.
✓ Branch 4 taken 108 times.
329 if (node->id == id)
279 {
280 221 return node;
281 }
282 }
283
284 return nullptr;
285 }
286
287 39 NAV::OutputPin* NAV::NodeManager::FindOutputPin(ax::NodeEditor::PinId id)
288 {
289
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
39 if (!id) { return nullptr; }
290
291
1/2
✓ Branch 5 taken 42 times.
✗ Branch 6 not taken.
42 for (auto& node : m_nodes)
292 {
293
3/6
✓ Branch 0 taken 42 times.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 42 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 42 times.
42 if (!node || node->kind == Node::Kind::GroupBox) { continue; }
294
2/2
✓ Branch 5 taken 42 times.
✓ Branch 6 taken 3 times.
45 for (auto& pin : node->outputPins)
295 {
296
3/4
✓ Branch 1 taken 42 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 39 times.
✓ Branch 4 taken 3 times.
42 if (pin.id == id) { return &pin; }
297 }
298 }
299
300 return nullptr;
301 }
302
303 NAV::InputPin* NAV::NodeManager::FindInputPin(ax::NodeEditor::PinId id)
304 {
305 if (!id) { return nullptr; }
306
307 for (auto& node : m_nodes)
308 {
309 if (!node || node->kind == Node::Kind::GroupBox) { continue; }
310 for (auto& pin : node->inputPins)
311 {
312 if (pin.id == id) { return &pin; }
313 }
314 }
315
316 return nullptr;
317 }
318
319 111 void NAV::NodeManager::EnableAllCallbacks()
320 {
321 LOG_TRACE("called");
322
2/2
✓ Branch 5 taken 344 times.
✓ Branch 6 taken 111 times.
455 for (auto* node : m_nodes)
323 {
324
8/10
✓ Branch 0 taken 344 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 344 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 343 times.
✓ Branch 6 taken 1 times.
✓ Branch 8 taken 340 times.
✓ Branch 9 taken 3 times.
✓ Branch 10 taken 340 times.
✓ Branch 11 taken 4 times.
344 if (node && !node->isDisabled() && node->kind != Node::Kind::GroupBox)
325 {
326 340 node->callbacksEnabled = true;
327 }
328 }
329 111 }
330
331 222 void NAV::NodeManager::DisableAllCallbacks()
332 {
333 LOG_TRACE("called");
334
2/2
✓ Branch 4 taken 688 times.
✓ Branch 5 taken 222 times.
910 for (auto* node : m_nodes)
335 {
336 688 node->callbacksEnabled = false;
337 }
338 222 }
339
340 111 void NAV::NodeManager::ClearAllNodeQueues()
341 {
342 LOG_TRACE("called");
343
2/2
✓ Branch 5 taken 344 times.
✓ Branch 6 taken 111 times.
455 for (auto* node : m_nodes)
344 {
345
2/2
✓ Branch 5 taken 271 times.
✓ Branch 6 taken 344 times.
615 for (auto& inputPin : node->inputPins)
346 {
347 271 inputPin.queue.clear();
348 }
349 }
350 111 }
351
352 223 bool NAV::NodeManager::InitializeAllNodes()
353 {
354 LOG_TRACE("called");
355 223 bool nodeCouldNotInitialize = false;
356
357 223 InitializeAllNodesAsync();
358
359
2/2
✓ Branch 5 taken 690 times.
✓ Branch 6 taken 223 times.
913 for (auto* node : m_nodes)
360 {
361
11/14
✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 684 times.
✓ Branch 4 taken 6 times.
✓ Branch 6 taken 684 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 682 times.
✓ Branch 9 taken 2 times.
✓ Branch 11 taken 682 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 155 times.
✓ Branch 14 taken 527 times.
✓ Branch 15 taken 155 times.
✓ Branch 16 taken 535 times.
690 if (node && node->kind != Node::Kind::GroupBox && !node->isDisabled() && !node->isInitialized())
362 {
363
3/4
✓ Branch 1 taken 155 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 154 times.
155 if (!node->doInitialize(true))
364 {
365
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 LOG_ERROR("Node '{}' could not initialize.", node->nameId());
366 1 nodeCouldNotInitialize = true;
367 }
368 }
369 }
370
371 223 return !nodeCouldNotInitialize;
372 }
373
374 223 void NAV::NodeManager::InitializeAllNodesAsync()
375 {
376 LOG_TRACE("called");
377
378
2/2
✓ Branch 5 taken 690 times.
✓ Branch 6 taken 223 times.
913 for (auto* node : m_nodes)
379 {
380
11/14
✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 684 times.
✓ Branch 4 taken 6 times.
✓ Branch 6 taken 684 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 682 times.
✓ Branch 9 taken 2 times.
✓ Branch 11 taken 682 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 342 times.
✓ Branch 14 taken 340 times.
✓ Branch 15 taken 342 times.
✓ Branch 16 taken 348 times.
690 if (node && node->kind != Node::Kind::GroupBox && !node->isDisabled() && !node->isInitialized())
381 {
382
1/2
✓ Branch 1 taken 342 times.
✗ Branch 2 not taken.
342 node->doInitialize();
383 }
384 }
385 223 }
386
387 #ifdef TESTING
388
389 namespace
390 {
391 std::vector<std::pair<ax::NodeEditor::PinId, NAV::InputPin::WatcherCallback>> watcherPinList;
392 std::vector<std::pair<ax::NodeEditor::LinkId, NAV::InputPin::WatcherCallback>> watcherLinkList;
393
394 std::function<void()> preInitCallback = nullptr;
395 std::function<void()> cleanupCallback = nullptr;
396
397 } // namespace
398
399 143 void NAV::NodeManager::RegisterWatcherCallbackToInputPin(ax::NodeEditor::PinId id, const InputPin::WatcherCallback& callback)
400 {
401 143 watcherPinList.emplace_back(id, callback);
402 143 }
403
404 void NAV::NodeManager::RegisterWatcherCallbackToLink(ax::NodeEditor::LinkId id, const InputPin::WatcherCallback& callback)
405 {
406 watcherLinkList.emplace_back(id, callback);
407 }
408
409 111 void NAV::NodeManager::ApplyWatcherCallbacks()
410 {
411
1/2
✗ Branch 7 not taken.
✓ Branch 8 taken 111 times.
111 for (auto& [linkId, callback] : watcherLinkList)
412 {
413 for (auto& node : m_nodes)
414 {
415 for (size_t pinIdx = 0; pinIdx < node->inputPins.size(); pinIdx++)
416 {
417 auto& pin = node->inputPins[pinIdx];
418 if (pin.isPinLinked() && pin.link.linkId == linkId)
419 {
420 LOG_DEBUG("Adding watcher callback on node '{}' on pin with index {}", pin.parentNode->nameId(), pinIdx);
421 pin.watcherCallbacks.emplace_back(callback);
422 }
423 }
424 }
425 }
426
427
2/2
✓ Branch 7 taken 143 times.
✓ Branch 8 taken 111 times.
254 for (auto& [id, callback] : watcherPinList)
428 {
429
2/2
✓ Branch 5 taken 740 times.
✓ Branch 6 taken 143 times.
883 for (auto& node : m_nodes)
430 {
431
2/2
✓ Branch 1 taken 725 times.
✓ Branch 2 taken 740 times.
1465 for (size_t pinIdx = 0; pinIdx < node->inputPins.size(); pinIdx++)
432 {
433 725 auto& pin = node->inputPins[pinIdx];
434
3/4
✓ Branch 1 taken 725 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 143 times.
✓ Branch 4 taken 582 times.
725 if (pin.id == id)
435 {
436
3/6
✓ Branch 1 taken 143 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 143 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 143 times.
✗ Branch 9 not taken.
143 LOG_DEBUG("Adding watcher callback on node '{}' on pin with index {}", pin.parentNode->nameId(), pinIdx);
437
1/2
✓ Branch 1 taken 143 times.
✗ Branch 2 not taken.
143 pin.watcherCallbacks.emplace_back(callback);
438 }
439 }
440 }
441 }
442 111 }
443
444 103 void NAV::NodeManager::RegisterPreInitCallback(std::function<void()> callback)
445 {
446 103 preInitCallback = std::move(callback);
447 103 }
448
449 112 void NAV::NodeManager::CallPreInitCallback()
450 {
451
2/2
✓ Branch 1 taken 103 times.
✓ Branch 2 taken 9 times.
112 if (preInitCallback)
452 {
453 103 preInitCallback();
454 }
455 112 }
456
457 38 void NAV::NodeManager::RegisterCleanupCallback(std::function<void()> callback)
458 {
459 38 cleanupCallback = std::move(callback);
460 38 }
461 111 void NAV::NodeManager::CallCleanupCallback()
462 {
463
2/2
✓ Branch 1 taken 38 times.
✓ Branch 2 taken 73 times.
111 if (cleanupCallback)
464 {
465 38 cleanupCallback();
466 }
467 111 }
468
469 112 void NAV::NodeManager::ClearRegisteredCallbacks()
470 {
471 112 watcherPinList.clear();
472 112 watcherLinkList.clear();
473 112 preInitCallback = nullptr;
474 112 cleanupCallback = nullptr;
475 112 }
476
477 #endif
478