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