Add average and max aggregator functions

This commit is contained in:
2023-03-15 15:16:56 +01:00
parent 7b0b419a22
commit f383eb1b79
8 changed files with 141 additions and 72 deletions

View File

@@ -7,6 +7,7 @@
#include <nlohmann/json.hpp>
#include <Settings.h>
#include <fan/Aggregators.h>
#include <fan/Fan.h>
#include <fan/FanCurve.h>
#include <sensor/Sensor.h>
@@ -16,20 +17,22 @@
using json = nlohmann::json;
class Serializer {
class Serializer
{
public:
Serializer();
void SerializeFans(std::vector<std::shared_ptr<Fan>> fans);
std::vector<std::shared_ptr<Fan>>
DeserializeFans(std::vector<std::shared_ptr<Sensor>> availableSensors);
std::vector<std::shared_ptr<FanCurve>>
DeserializeFanCurves(std::vector<std::shared_ptr<Sensor>> availableSensors,
std::vector<std::shared_ptr<Fan>> availableFans);
std::vector<std::shared_ptr<Fan>> DeserializeFans(
std::vector<std::shared_ptr<Sensor>> availableSensors);
std::vector<std::shared_ptr<FanCurve>> DeserializeFanCurves(
std::vector<std::shared_ptr<Sensor>> availableSensors,
std::vector<std::shared_ptr<Fan>> availableFans);
std::shared_ptr<Settings> DeserializeSettings();
private:
void WriteJson(json o);
json ReadJson();
std::unique_ptr<Aggregator> aggregatorFromString(std::string str) const;
};
#endif // SERIALIZER_H_