Commit 4a4a4462 authored by Pascal Palenda's avatar Pascal Palenda
Browse files

Refine filter network behaviour - WIP

parent e8f55de4
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// std includes // std includes
#include <unordered_map> #include <unordered_map>
#include <memory>
#include <vector> #include <vector>
namespace ITA namespace ITA
...@@ -74,7 +75,7 @@ namespace ITA ...@@ -74,7 +75,7 @@ namespace ITA
std::unordered_map<std::string, std::unique_ptr<IAudibilityFilter>> m_mAudibilityFilters; std::unordered_map<std::string, std::unique_ptr<IAudibilityFilter>> m_mAudibilityFilters;
NetworkTreeNode m_oNetworkTree; std::unique_ptr<NetworkTreeNode> m_pNetworkTree;
}; };
} // namespace audibility_filter } // namespace audibility_filter
} // namespace simulation_scheduler } // namespace simulation_scheduler
......
...@@ -79,7 +79,10 @@ namespace ITA ...@@ -79,7 +79,10 @@ namespace ITA
bool CFilterNetwork::evaluateNetwork ( const CUpdateScene& previousState, const CUpdateScene& newUpdate ) bool CFilterNetwork::evaluateNetwork ( const CUpdateScene& previousState, const CUpdateScene& newUpdate )
{ {
return m_oNetworkTree.evaluate ( previousState, newUpdate ); if ( m_pNetworkTree )
return m_pNetworkTree->evaluate ( previousState, newUpdate );
else
return true;
} }
CFilterNetwork::NetworkTreeNode::NetworkTreeNode ( const IAudibilityFilter* pFilter, CFilterNetwork::NetworkTreeNode::NetworkTreeNode ( const IAudibilityFilter* pFilter,
...@@ -132,18 +135,25 @@ namespace ITA ...@@ -132,18 +135,25 @@ namespace ITA
void CFilterNetwork::buildNetwork ( const FilterNetworkConfig& oConfig ) void CFilterNetwork::buildNetwork ( const FilterNetworkConfig& oConfig )
{ {
std::map<std::string, std::shared_ptr<IAudibilityFilter::AudibilityFilterConfig>> mConfigMap; if ( !oConfig.vpFilterConfigs.empty() && oConfig.sStartFilter.size() != 0 )
for ( const auto& filterConfig : oConfig.vpFilterConfigs )
{ {
mConfigMap.insert ( { filterConfig->sFilterName , filterConfig } ); std::map<std::string, std::shared_ptr<IAudibilityFilter::AudibilityFilterConfig>> mConfigMap;
}
for ( const auto& filterConfig : oConfig.vpFilterConfigs )
{
mConfigMap.insert ( { filterConfig->sFilterName , filterConfig } );
}
m_oNetworkTree = NetworkTreeNode ( m_mAudibilityFilters.at ( oConfig.sStartFilter ).get ( ), m_pNetworkTree = std::make_unique<NetworkTreeNode> ( m_mAudibilityFilters.at ( oConfig.sStartFilter ).get ( ),
mConfigMap.at ( oConfig.sStartFilter )->eUsageMode, mConfigMap.at ( oConfig.sStartFilter )->eUsageMode,
mConfigMap.at ( oConfig.sStartFilter )->bInvertCondition ); mConfigMap.at ( oConfig.sStartFilter )->bInvertCondition );
networkBuilderHelper ( mConfigMap, m_oNetworkTree, *mConfigMap.at ( oConfig.sStartFilter ) ); networkBuilderHelper ( mConfigMap, *m_pNetworkTree, *mConfigMap.at ( oConfig.sStartFilter ) );
}
else
{
m_pNetworkTree = nullptr;
}
} }
void CFilterNetwork::networkBuilderHelper ( void CFilterNetwork::networkBuilderHelper (
......
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