Commit 7b39ee1d authored by Alessio Netti's avatar Alessio Netti

DA: name uniqueness checks

- We enforce that instantiated analyzers have unique names
- The checks are carried out by the MQTTChecker class, which maintains
group/analyzer names in a separate sets with respect to MQTT topics
parent 75197e31
......@@ -171,22 +171,27 @@ bool AnalyticsManager::reload(boost::asio::io_service& io, const string& plugin)
void AnalyticsManager::removeTopics(an_dl_t p) {
MQTTChecker& mqttCheck = MQTTChecker::getInstance();
for(const auto& a : p.configurator->getAnalyzers())
if( a->getStreaming() )
for(const auto& u : a->getUnits())
for(const auto& o: u->getBaseOutputs())
for(const auto& a : p.configurator->getAnalyzers()) {
mqttCheck.removeName(a->getName());
if (a->getStreaming())
for (const auto &u : a->getUnits())
for (const auto &o: u->getBaseOutputs())
mqttCheck.removeTopic(o->getMqtt());
}
}
bool AnalyticsManager::checkTopics(an_dl_t p) {
MQTTChecker& mqttCheck = MQTTChecker::getInstance();
bool validTopics=true;
for(const auto& a : p.configurator->getAnalyzers())
if( a->getStreaming() )
for(const auto& u : a->getUnits())
for(const auto& o: u->getBaseOutputs())
if(!mqttCheck.checkTopic(o->getMqtt()))
for(const auto& a : p.configurator->getAnalyzers()) {
if (!mqttCheck.checkName(a->getName()))
validTopics = false;
if (a->getStreaming())
for (const auto &u : a->getUnits())
for (const auto &o: u->getBaseOutputs())
if (!mqttCheck.checkTopic(o->getMqtt()))
validTopics = false;
}
return validTopics;
}
......
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