AverageConfigurator.cpp 936 Bytes
Newer Older
1
2
3
4
5
6
7
8
//
// Created by Netti, Alessio on 16.01.19.
//

#include "AverageConfigurator.h"

AverageConfigurator::AverageConfigurator() : AnalyzerConfiguratorTemplate() {
        _analyzerName = "average";
Alessio Netti's avatar
Alessio Netti committed
9
        _baseName     = "sensor";
10
11
12
13
14
15
16
17
18
}

AverageConfigurator::~AverageConfigurator() {}

void AverageConfigurator::sensorBase(SensorBase& s, CFG_VAL config) {

}

void AverageConfigurator::analyzer(AverageAnalyzer& a, CFG_VAL config) {
Alessio Netti's avatar
Alessio Netti committed
19
20
21
22
23
        BOOST_FOREACH(boost::property_tree::iptree::value_type &val, config)
        {
                if (boost::iequals(val.first, "window"))
                        a.setWindow(stoull(val.second.data()) * 1000000);
        }
24
25
}

Alessio Netti's avatar
Alessio Netti committed
26
27
28
29
30
31
32
bool AverageConfigurator::unit(UnitTemplate<SensorBase>& u) {
        if(u.getOutputs().size() != _outputs) {
                LOG(error) << "AverageAnalyzer Supports only 2 outputs per unit!";
                return false;
        }
        else
                return true;
33
}