1 #pragma once 2 3 #include "interfaces/report_factory.hpp" 4 #include "interfaces/sensor.hpp" 5 #include "sensor_cache.hpp" 6 7 #include <boost/asio/io_context.hpp> 8 #include <sdbusplus/asio/object_server.hpp> 9 10 class ReportFactory : public interfaces::ReportFactory 11 { 12 public: 13 ReportFactory( 14 std::shared_ptr<sdbusplus::asio::connection> bus, 15 const std::shared_ptr<sdbusplus::asio::object_server>& objServer, 16 SensorCache& sensorCache); 17 18 std::vector<LabeledMetricParameters> convertMetricParams( 19 boost::asio::yield_context& yield, 20 const ReadingParameters& metricParams) const override; 21 22 std::unique_ptr<interfaces::Report> 23 make(const std::string& name, const std::string& reportingType, 24 bool emitsReadingsSignal, bool logToMetricReportsCollection, 25 Milliseconds period, uint64_t appendLimitIn, 26 const std::string& reportUpdatesIn, 27 interfaces::ReportManager& reportManager, 28 interfaces::JsonStorage& reportStorage, 29 std::vector<LabeledMetricParameters> labeledMetricParams, 30 bool enabled) const override; 31 32 private: 33 Sensors getSensors( 34 const std::vector<LabeledSensorParameters>& sensorPaths) const; 35 36 std::shared_ptr<sdbusplus::asio::connection> bus; 37 std::shared_ptr<sdbusplus::asio::object_server> objServer; 38 SensorCache& sensorCache; 39 }; 40