regulators: Create SensorMonitoring class

Create C++ class that implements the 'sensor_monitoring' element from
the JSON config file.  See sensor_monitoring.md for more information.

The execute() method of this class will be implemented in a future
commit.

Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: Ifd0530e54d71a5292e8f4e5cad0a13195e801ed8
diff --git a/phosphor-regulators/src/sensor_monitoring.hpp b/phosphor-regulators/src/sensor_monitoring.hpp
new file mode 100644
index 0000000..7572436
--- /dev/null
+++ b/phosphor-regulators/src/sensor_monitoring.hpp
@@ -0,0 +1,88 @@
+/**
+ * Copyright © 2020 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 <memory>
+#include <utility>
+#include <vector>
+
+namespace phosphor::power::regulators
+{
+
+/**
+ * @class SensorMonitoring
+ *
+ * Defines how to read the sensors for a voltage rail, such as voltage output,
+ * current output, and temperature.
+ *
+ * Sensor values are measured, actual values rather than target values.
+ *
+ * Sensors are read once per second.  The sensor values are stored on D-Bus,
+ * making them available to external interfaces like Redfish.
+ *
+ * Sensors are read by executing actions, such as PMBusReadSensorAction.  To
+ * read multiple sensors for a rail, multiple actions need to be executed.
+ */
+class SensorMonitoring
+{
+  public:
+    // Specify which compiler-generated methods we want
+    SensorMonitoring() = delete;
+    SensorMonitoring(const SensorMonitoring&) = delete;
+    SensorMonitoring(SensorMonitoring&&) = delete;
+    SensorMonitoring& operator=(const SensorMonitoring&) = delete;
+    SensorMonitoring& operator=(SensorMonitoring&&) = delete;
+    ~SensorMonitoring() = default;
+
+    /**
+     * Constructor.
+     *
+     * @param actions actions that read the sensors for a rail
+     */
+    explicit SensorMonitoring(std::vector<std::unique_ptr<Action>> actions) :
+        actions{std::move(actions)}
+    {
+    }
+
+    /**
+     * Executes the actions to read the sensors for a rail.
+     */
+    void execute()
+    {
+        // TODO: Create ActionEnvironment, execute actions, store sensor values
+        // on D-Bus, catch and handle any exceptions
+    }
+
+    /**
+     * Returns the actions that read the sensors for a rail.
+     *
+     * @return actions
+     */
+    const std::vector<std::unique_ptr<Action>>& getActions() const
+    {
+        return actions;
+    }
+
+  private:
+    /**
+     * Actions that read the sensors for a rail.
+     */
+    std::vector<std::unique_ptr<Action>> actions{};
+};
+
+} // namespace phosphor::power::regulators
diff --git a/phosphor-regulators/test/meson.build b/phosphor-regulators/test/meson.build
index 38c038d..547529c 100644
--- a/phosphor-regulators/test/meson.build
+++ b/phosphor-regulators/test/meson.build
@@ -12,6 +12,7 @@
     'presence_detection_tests.cpp',
     'rail_tests.cpp',
     'rule_tests.cpp',
+    'sensor_monitoring_tests.cpp',
     'write_verification_error_tests.cpp',
 
     'actions/action_environment_tests.cpp',
diff --git a/phosphor-regulators/test/sensor_monitoring_tests.cpp b/phosphor-regulators/test/sensor_monitoring_tests.cpp
new file mode 100644
index 0000000..49b8a10
--- /dev/null
+++ b/phosphor-regulators/test/sensor_monitoring_tests.cpp
@@ -0,0 +1,56 @@
+/**
+ * Copyright © 2020 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.
+ */
+#include "action.hpp"
+#include "mock_action.hpp"
+#include "sensor_monitoring.hpp"
+
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include <gtest/gtest.h>
+
+using namespace phosphor::power::regulators;
+
+TEST(SensorMonitoringTests, Constructor)
+{
+    std::vector<std::unique_ptr<Action>> actions{};
+    actions.push_back(std::make_unique<MockAction>());
+
+    SensorMonitoring sensorMonitoring(std::move(actions));
+    EXPECT_EQ(sensorMonitoring.getActions().size(), 1);
+}
+
+TEST(SensorMonitoringTests, Execute)
+{
+    // TODO: Implement test when execute() function is done
+}
+
+TEST(SensorMonitoringTests, GetActions)
+{
+    std::vector<std::unique_ptr<Action>> actions{};
+
+    MockAction* action1 = new MockAction{};
+    actions.push_back(std::unique_ptr<MockAction>{action1});
+
+    MockAction* action2 = new MockAction{};
+    actions.push_back(std::unique_ptr<MockAction>{action2});
+
+    SensorMonitoring sensorMonitoring(std::move(actions));
+    EXPECT_EQ(sensorMonitoring.getActions().size(), 2);
+    EXPECT_EQ(sensorMonitoring.getActions()[0].get(), action1);
+    EXPECT_EQ(sensorMonitoring.getActions()[1].get(), action2);
+}