mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Add simulators
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
#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();
|
||||
}
|
||||
Reference in New Issue
Block a user