0.5.1
Loading...
Searching...
No Matches
RunMenu.cpp
Go to the documentation of this file.
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 "RunMenu.hpp"
10
11#include <imgui.h>
12
15
16#include "util/Logger.hpp"
17
19{
20 bool hasInitializedNodes = false;
21 bool hasDeInitializedNodes = false;
22 for (const auto* node : flow::m_Nodes())
23 {
24 if (node->getState() == Node::State::Initialized)
25 {
26 hasInitializedNodes = true;
27 }
28 else if (node->getState() == Node::State::Deinitialized)
29 {
30 hasDeInitializedNodes = true;
31 }
32 }
33 if (ImGui::MenuItem("Initialize all Nodes", nullptr, false, hasDeInitializedNodes))
34 {
35 for (auto* node : flow::m_Nodes())
36 {
37 if (node->getState() == Node::State::Deinitialized)
38 {
39 node->doInitialize();
40 }
41 }
42 }
43 if (ImGui::MenuItem("Reinitialize all Nodes", nullptr, false, hasInitializedNodes))
44 {
45 for (auto* node : flow::m_Nodes())
46 {
47 if (node->isInitialized())
48 {
49 node->doReinitialize();
50 }
51 else if (node->getState() == Node::State::Deinitialized)
52 {
53 node->doInitialize();
54 }
55 }
56 }
57 if (ImGui::MenuItem("Deinitialize all Nodes", nullptr, false, hasInitializedNodes))
58 {
59 for (auto* node : flow::m_Nodes())
60 {
61 if (node->isInitialized())
62 {
63 node->doDeinitialize();
64 }
65 }
66 }
67
68 ImGui::Separator();
69
70 if (ImGui::MenuItem("Run Flow", "F7", false, !FlowExecutor::isRunning()))
71 {
73 {
74 LOG_INFO("Starting Flow Execution");
76 }
77 }
78 if (ImGui::MenuItem("Stop Execution", "Esc", false, FlowExecutor::isRunning()))
79 {
81 {
82 LOG_INFO("Canceling Execution...");
84 LOG_INFO("Execution canceled");
85 }
86 }
87}
Flow Executor Thread.
Save/Load the Nodes.
Utility class for logging to console and file.
#define LOG_INFO
Info to the user on the state of the program.
Definition Logger.hpp:69
Run Menu.
@ Initialized
Node is initialized (green)
Definition Node.hpp:181
@ Deinitialized
Node is deinitialized (red)
Definition Node.hpp:178
bool isRunning() noexcept
Checks if the thread is running.
void start()
Starts the Thread.
void stop()
Stops the Thread.
const std::vector< Node * > & m_Nodes()
List of all registered Nodes.
void ShowRunMenu()
Show the run menu dropdown.
Definition RunMenu.cpp:18