Commit 39479779 authored by Alessio Netti's avatar Alessio Netti
Browse files

Analytics: fixing sensor cache initialization

parent 75563503
...@@ -225,7 +225,7 @@ protected: ...@@ -225,7 +225,7 @@ protected:
// The job unit is generated as a hierarchical unit // The job unit is generated as a hierarchical unit
jobUnit = unitGen.generateFromTemplate(uTemplate, jobTopic, jobData.nodes, this->_mqttPart, this->_enforceTopics, this->_relaxed); jobUnit = unitGen.generateFromTemplate(uTemplate, jobTopic, jobData.nodes, this->_mqttPart, this->_enforceTopics, this->_relaxed);
// Initializing sensors if necessary // Initializing sensors if necessary
jobUnit->init(this->_cacheSize); jobUnit->init(this->_interval);
this->addToUnitCache(jobUnit); this->addToUnitCache(jobUnit);
} }
return jobUnit; return jobUnit;
......
...@@ -231,7 +231,7 @@ public: ...@@ -231,7 +231,7 @@ public:
OperatorInterface::init(io); OperatorInterface::init(io);
for(const auto u : _units) for(const auto u : _units)
u->init(_cacheSize); u->init(_interval);
this->execOnInit(); this->execOnInit();
} }
...@@ -350,7 +350,7 @@ public: ...@@ -350,7 +350,7 @@ public:
addToUnitCache(tempUnit); addToUnitCache(tempUnit);
} }
// Initializing sensors if necessary // Initializing sensors if necessary
tempUnit->init(_cacheSize); tempUnit->init(_interval);
compute(tempUnit); compute(tempUnit);
retrieveAndFlush(outMap, tempUnit); retrieveAndFlush(outMap, tempUnit);
} catch(const exception& e) { } catch(const exception& e) {
......
...@@ -59,9 +59,9 @@ public: ...@@ -59,9 +59,9 @@ public:
/** /**
* @brief Initializes the sensors in the unit * @brief Initializes the sensors in the unit
* *
* @param cacheSize size of the sensor cache * @param interval Sampling interval in milliseconds
*/ */
virtual void init(unsigned int cacheSize) = 0; virtual void init(unsigned int interval) = 0;
/** /**
* @brief Sets the name of this unit * @brief Sets the name of this unit
......
...@@ -177,16 +177,16 @@ public: ...@@ -177,16 +177,16 @@ public:
/** /**
* @brief Initializes the sensors in the unit * @brief Initializes the sensors in the unit
* *
* @param cacheSize size of the sensor cache * @param interval Sampling interval in milliseconds
*/ */
void init(unsigned int cacheSize) override { void init(unsigned int interval) override {
for(const auto s : _outputs) for(const auto s : _outputs)
if (!s->isInit()) if (!s->isInit())
s->initSensor(cacheSize); s->initSensor(interval);
for (const auto &su : _subUnits) for (const auto &su : _subUnits)
for (const auto s : su->getOutputs()) for (const auto s : su->getOutputs())
if (!s->isInit()) if (!s->isInit())
s->initSensor(cacheSize); s->initSensor(interval);
} }
/** /**
......
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