mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-26 21:51:13 +01:00
64 lines
1.1 KiB
C++
64 lines
1.1 KiB
C++
#include "simulators.hpp"
|
|
#include "test_sim.hpp"
|
|
|
|
Simulators::Simulators()
|
|
{
|
|
|
|
}
|
|
|
|
void Simulators::run()
|
|
{
|
|
if (this->p_simulators.empty())
|
|
{
|
|
return;
|
|
}
|
|
if (this->p_current_simulator.empty())
|
|
{
|
|
return;
|
|
}
|
|
|
|
this->p_simulators.at(p_current_simulator)->run();
|
|
}
|
|
|
|
void Simulators::stop()
|
|
{
|
|
if (this->p_simulators.empty())
|
|
{
|
|
return;
|
|
}
|
|
if (this->p_current_simulator.empty())
|
|
{
|
|
return;
|
|
}
|
|
|
|
this->p_simulators.at(p_current_simulator)->stop();
|
|
}
|
|
|
|
void Simulators::switch_simulator(std::string name)
|
|
{
|
|
if (this->p_simulators.empty())
|
|
{
|
|
return;
|
|
}
|
|
if (!this->p_current_simulator.empty())
|
|
{
|
|
this->p_simulators.at(p_current_simulator)->stop();
|
|
}
|
|
|
|
this->p_current_simulator = name;
|
|
this->p_simulators.at(p_current_simulator)->run();
|
|
}
|
|
|
|
Simulator_base* Simulators::invoke_active_simulator() const
|
|
{
|
|
if (this->p_simulators.empty())
|
|
{
|
|
return nullptr;
|
|
}
|
|
if (this->p_current_simulator.empty())
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
return this->p_simulators.at(p_current_simulator).get();
|
|
} |