1 #pragma once
2
3 #include "utils/conversion.hpp"
4
5 #include <sdbusplus/exception.hpp>
6
7 #include <array>
8 #include <cstdint>
9 #include <string_view>
10 #include <type_traits>
11
12 enum class ReportUpdates : uint32_t
13 {
14 overwrite,
15 appendStopsWhenFull,
16 appendWrapsWhenFull
17 };
18
19 namespace utils
20 {
21
22 template <>
23 struct EnumTraits<ReportUpdates>
24 {
25 static constexpr auto propertyName = ConstexprString{"ReportUpdates"};
26 };
27
28 constexpr auto convDataReportUpdates = std::array{
29 std::make_pair<std::string_view, ReportUpdates>(
30 "xyz.openbmc_project.Telemetry.Report.ReportUpdates.Overwrite",
31 ReportUpdates::overwrite),
32 std::make_pair<std::string_view, ReportUpdates>(
33 "xyz.openbmc_project.Telemetry.Report.ReportUpdates."
34 "AppendStopsWhenFull",
35 ReportUpdates::appendStopsWhenFull),
36 std::make_pair<std::string_view, ReportUpdates>(
37 "xyz.openbmc_project.Telemetry.Report.ReportUpdates."
38 "AppendWrapsWhenFull",
39 ReportUpdates::appendWrapsWhenFull)};
40
41 inline ReportUpdates
toReportUpdates(std::underlying_type_t<ReportUpdates> value)42 toReportUpdates(std::underlying_type_t<ReportUpdates> value)
43 {
44 return toEnum<ReportUpdates, minEnumValue(convDataReportUpdates),
45 maxEnumValue(convDataReportUpdates)>(value);
46 }
47
toReportUpdates(const std::string & value)48 inline ReportUpdates toReportUpdates(const std::string& value)
49 {
50 return toEnum(convDataReportUpdates, value);
51 }
52
enumToString(ReportUpdates value)53 inline std::string enumToString(ReportUpdates value)
54 {
55 return std::string(enumToString(convDataReportUpdates, value));
56 }
57
58 } // namespace utils
59