Commit e8f55de4 authored by Pascal Palenda's avatar Pascal Palenda
Browse files

Adapt scheduler to filter network - WIP

parent 88febc59
......@@ -135,15 +135,15 @@ namespace ITA
/// However, it could also be useful in the long run.
/// \return a vector of pointers to the workers.
///
std::vector<IWorkerInterface*> getWorker ( );
std::vector<IWorkerInterface*> getWorker ( ) const;
///
/// \brief Gets a vector of pointers to the filters.
/// \brief Gets pointer to the filter network.
/// \note This function is primarily for testing.
/// However, it could also be useful in the long run.
/// \return a vector of pointers to the filters.
/// \return a pointer to the filter network.
///
std::vector<audibility_filter::IAudibilityFilter*> getFilter ( );
audibility_filter::CFilterNetwork* getFilterNetwork ( ) const;
private:
///
......@@ -180,10 +180,9 @@ namespace ITA
std::vector<std::unique_ptr<IWorkerInterface>> m_vWorker;
///
/// \brief List of the audibility filters belonging to CScheduler.
/// \remark The order of the filters matters, thus this is a std::list.
/// \brief Filter network of the CScheduler.
///
std::list<std::unique_ptr<audibility_filter::IAudibilityFilter>> m_lAudibilityFilters;
std::unique_ptr<audibility_filter::CFilterNetwork> m_pFilterNetwork;
///
/// \brief Concurrent queue to handle the input of new Updates.
......
......@@ -79,10 +79,7 @@ namespace ITA
m_vWorker.push_back ( std::move ( CWorkerFactory::createWorker ( workerConfig, this ) ) );
}
for ( const auto& workerConfig : workerConfigs )
{
m_vWorker.push_back ( std::move ( CWorkerFactory::createWorker ( workerConfig, this ) ) );
}
m_pFilterNetwork = std::make_unique<audibility_filter::CFilterNetwork> ( pConfig.oFilterNetworkConfig );
Run ( );
}
......@@ -136,13 +133,7 @@ namespace ITA
if ( m_mPreviousStates.find ( pUpdate->getReferenceID ( ) ) != m_mPreviousStates.end ( ) )
{
// Test if the update is audible.
// Note the extra condition in the for loop, this gains performance if a previous update indicates non audibility.
for ( auto& filterIter = m_lAudibilityFilters.begin ( );
bAudible && filterIter != m_lAudibilityFilters.end ( );
++filterIter )
{
bAudible &= ( *filterIter )->changeIsAudible ( *m_mPreviousStates.at ( pUpdate->getReferenceID ( ) ), *pUpdate );
}
bAudible = m_pFilterNetwork->evaluateNetwork ( *m_mPreviousStates.at ( pUpdate->getReferenceID ( ) ), *pUpdate );
}
if ( bAudible )
......@@ -264,7 +255,7 @@ namespace ITA
return true;
}
std::vector<IWorkerInterface*> CScheduler::getWorker ( )
std::vector<IWorkerInterface*> CScheduler::getWorker ( ) const
{
std::vector<IWorkerInterface*> vec;
......@@ -276,16 +267,9 @@ namespace ITA
return vec;
}
std::vector<audibility_filter::IAudibilityFilter*> CScheduler::getFilter ( )
audibility_filter::CFilterNetwork* CScheduler::getFilterNetwork ( ) const
{
std::vector<audibility_filter::IAudibilityFilter*> vec;
for ( const auto& filter : m_lAudibilityFilters )
{
vec.push_back ( filter.get ( ) );
}
return vec;
return m_pFilterNetwork.get ( );
}
} // namespace simulation_scheduler
} // namespace ITA
\ No newline at end of file
Supports Markdown
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