Create regulators action_utils namespace

Create the action_utils namespace for utility functions related to the
regulators action framework.

Create a function in that namespace that executes a vector of actions.

Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I22297435daad0d5f6ad61157c094938f0488f076
diff --git a/phosphor-regulators/src/actions/action_utils.hpp b/phosphor-regulators/src/actions/action_utils.hpp
new file mode 100644
index 0000000..9ddff4f
--- /dev/null
+++ b/phosphor-regulators/src/actions/action_utils.hpp
@@ -0,0 +1,64 @@
+/**
+ * Copyright © 2019 IBM Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include "action.hpp"
+#include "action_environment.hpp"
+
+#include <memory>
+#include <vector>
+
+namespace phosphor
+{
+namespace power
+{
+namespace regulators
+{
+namespace action_utils
+{
+
+/**
+ * This file contains utility functions related to the regulators action
+ * framework.
+ */
+
+/**
+ * Executes one or more actions in sequential order.
+ *
+ * Returns the return value from the last action in the vector.
+ *
+ * Throws an exception if an error occurs and an action cannot be
+ * successfully executed.
+ *
+ * @param actions actions to execute
+ * @param environment action execution environment
+ * @return return value from last action in vector
+ */
+inline bool execute(std::vector<std::unique_ptr<Action>>& actions,
+                    ActionEnvironment& environment)
+{
+    bool returnValue{true};
+    for (std::unique_ptr<Action>& action : actions)
+    {
+        returnValue = action->execute(environment);
+    }
+    return returnValue;
+}
+
+} // namespace action_utils
+} // namespace regulators
+} // namespace power
+} // namespace phosphor