| #ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_CONFIGS_PROTO_CONFIG_PARSER_H_ |
| #define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_CONFIGS_PROTO_CONFIG_PARSER_H_ |
| |
| #include <stdbool.h> |
| |
| #include <memory> |
| #include <string> |
| |
| #include "absl/strings/string_view.h" |
| #include "gpio_config.pb.h" |
| #include "gpio_fru_config.pb.h" |
| #include "led_config.pb.h" |
| #include "pcie_config.pb.h" |
| #include "power_control.pb.h" |
| #include "power_fault_log_config.pb.h" |
| #include "sel_config.pb.h" |
| #include "software_metrics_config.pb.h" |
| #include "thermal_config.pb.h" |
| #include "usb_fru_config.pb.h" |
| |
| namespace milotic_tlbmc { |
| |
| struct ProtoConfigData { |
| SoftwareMetricsConfig software_metrics_configs; |
| GpioConfigs gpio_configs; |
| PowerControlConfigs power_control_configs; |
| ThermalConfigs thermal_configs; |
| PowerFaultLogConfig power_fault_log_config; |
| SelConfig sel_config; |
| PcieConfigs pcie_configs; |
| GpioFruComponentConfigs gpio_fru_component_configs; |
| UsbFruComponentConfigs usb_fru_component_configs; |
| LedConfigs led_configs; |
| }; |
| |
| class ProtoConfigParser { |
| public: |
| static std::unique_ptr<ProtoConfigParser> Create( |
| absl::string_view config_path); |
| |
| void LoadProtoConfigs(); |
| SoftwareMetricsConfig GetSoftwareMetricsConfig() const; |
| GpioConfigs GetGpioConfigs() const; |
| PowerControlConfigs GetPowerControlConfigs() const; |
| ThermalConfigs GetThermalConfigs() const; |
| PowerFaultLogConfig GetPowerFaultLogConfig() const; |
| SelConfig GetSelConfig() const; |
| PcieConfigs GetPcieConfigs() const; |
| GpioFruComponentConfigs GetGpioFruComponentConfigs() const; |
| UsbFruComponentConfigs GetUsbFruComponentConfigs() const; |
| LedConfigs GetLedConfigs() const; |
| |
| explicit ProtoConfigParser(absl::string_view config_path) |
| : config_path_(config_path) {} |
| ProtoConfigParser() = default; |
| |
| private: |
| std::string config_path_; |
| ProtoConfigData data_store_; |
| }; |
| |
| } // namespace milotic_tlbmc |
| |
| #endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_CONFIGS_PROTO_CONFIG_PARSER_H_ |