regulators: Use std::optional in ActionEnvironment
Use the std::optional data type in the ActionEnvironment class to
represent an optional volts value setting.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: Ib66f7586a49d78d8e0241fb8e7e4ecd881d1ac01
diff --git a/phosphor-regulators/src/actions/pmbus_write_vout_command_action.cpp b/phosphor-regulators/src/actions/pmbus_write_vout_command_action.cpp
index ae5ac4d..238e2f2 100644
--- a/phosphor-regulators/src/actions/pmbus_write_vout_command_action.cpp
+++ b/phosphor-regulators/src/actions/pmbus_write_vout_command_action.cpp
@@ -131,10 +131,10 @@
// A volts value is defined for this action
voltsValue = volts.value();
}
- else if (environment.hasVolts())
+ else if (environment.getVolts().has_value())
{
// A volts value is defined in the ActionEnvironment
- voltsValue = environment.getVolts();
+ voltsValue = environment.getVolts().value();
}
else
{