5 #include "CommandManager.h" 9 std::cout <<
"Initialized command manager. Starting..." << std::endl;
21 m_commands.push_back(command);
22 m_command_flags.insert({command, 0});
30 m_command_flags[command] = -1;
38 for (
auto &command : m_commands) {
39 m_command_flags[command] = -1;
47 while (m_signal == 0) {
49 for (
auto &command : m_commands) {
50 int flag = m_command_flags[command];
51 if (!command->isFinished()) {
52 if (!command->isInitialized()) {
54 command->setIsRunning(
true);
55 }
else if (flag == -1)
58 m_command_flags[command] = 0;
59 }
else if (command->isRunning()) {
60 command->setIsRunning(command->execute());
69 std::cout <<
"Received stop signal." << std::endl;
75 std::cout <<
"Stopping command manager." << std::endl;
77 return Thread::join();
88 unsigned long sz = m_commands.size();
bool cancel(Command *command)
bool runCommand(Command *command)