Commit cfbcc8b1 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Trying to fix some problems with ART worker, still wip

parent e1fb0ed7
......@@ -55,7 +55,7 @@ namespace ITA
CARTSimulator& operator=(CARTSimulator&& other) = delete;
static std::unique_ptr<ISimulatorInterface> Create( const std::shared_ptr<ISimulatorInterface::SimulatorConfig>& );
static std::unique_ptr<ISimulatorInterface> Create( std::shared_ptr< const ISimulatorInterface::SimulatorConfig > );
//! \brief Reset the simulator.
inline void Reset() override { };
......
......@@ -51,9 +51,11 @@ namespace ITA
m_oEngine.eigenraySettings.rayTracing.maxReflectionOrder = 1; //Always expect exactly 2 eigenrays
}
std::unique_ptr<ISimulatorInterface> CARTSimulator::Create( const std::shared_ptr<ISimulatorInterface::SimulatorConfig>& pConfig )
std::unique_ptr<ISimulatorInterface> CARTSimulator::Create( std::shared_ptr< const ISimulatorInterface::SimulatorConfig > pConfig )
{
return std::make_unique<CARTSimulator>( dynamic_cast< const ARTSimulatorConfig& > ( *pConfig ) );
std::shared_ptr< const ARTSimulatorConfig > pConfigGenericShared = std::dynamic_pointer_cast< const ARTSimulatorConfig >( pConfig );
const ARTSimulatorConfig& oConf( *pConfigGenericShared );
return std::make_unique<CARTSimulator>( oConf );
}
......
......@@ -20,8 +20,10 @@ namespace ITA
//--------------------
#pragma region CONFIG
ISimulatorInterface::SimulatorConfig::SimulatorConfig() : SimulatorConfig("Unknown")
{}
ISimulatorInterface::SimulatorConfig::SimulatorConfig() : SimulatorConfig( "Unknown" )
{
}
ISimulatorInterface::SimulatorConfig::SimulatorConfig(const std::string & sType)
: m_sSimulatorType(sType)
, sSimulatorType(m_sSimulatorType)
......@@ -60,8 +62,11 @@ namespace ITA
std::map<std::string, std::pair<CSimulatorFactory::CreateCallback, CSimulatorFactory::ConfigCreateCallback>> CSimulatorFactory::m_mRegisteredSimulatorTypes =
{
#ifdef WITH_ART
{ OutdoorAcoustics::ART::CARTSimulator::GetType(), { OutdoorAcoustics::ART::CARTSimulator::Create, std::make_shared<OutdoorAcoustics::ART::CARTSimulator::SimulatorConfig> } },
{ OutdoorAcoustics::ART::CARTSimulator::GetType(), { OutdoorAcoustics::ART::CARTSimulator::Create, std::make_shared<OutdoorAcoustics::ART::CARTSimulator::ARTSimulatorConfig> } },
#endif
#ifdef WITH_URBAN
{ OutdoorAcoustics::Urban::CARTSimulator::GetType(), { OutdoorAcoustics::ART::CUrbanSimulator::Create, std::make_shared<OutdoorAcoustics::Urban::CUrbanSimulator::SimulatorConfig> } },
#endif
};
......@@ -79,7 +84,8 @@ namespace ITA
if (it != m_mRegisteredSimulatorTypes.end())
{
// call the creation callback to construct this derived type
return it->second.first(pConfig);
std::unique_ptr< ISimulatorInterface > pSimGeneric( it->second.first( pConfig ) );
return pSimGeneric;
}
return nullptr;
}
......
......@@ -68,8 +68,8 @@ namespace ITA
CWorkerThread::CWorkerThread(const WorkerThreadConfig& oConfig, ISchedulerInterface* pParent)
: IWorkerInterface(pParent), m_evTriggerLoop(VistaThreadEvent::NON_WAITABLE_EVENT)
{
//oConfig;
//m_oSimulator = std::make_unique<CSimulator> ( m_eFieldOfDuty, oConfig.sRavenProjectFilePath );
auto pSimulator = CSimulatorFactory::CreateSimulator( oConfig.pSimulatorConfig );
SetSimulator( std::move( pSimulator ) );
Run();
}
......@@ -118,7 +118,8 @@ namespace ITA
while (IsBusy()) VistaTimeUtils::Sleep(100);
// Reset the simulator
m_pSimulator->Reset();
if( m_pSimulator )
m_pSimulator->Reset();
// Reset the flags
m_bResetIndicated = false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment