Create PMBusBase class to allow for mocking

Derive the PMBus class from a new PMBusBase class to allow for the use
of Google Mock for unit testing. Create an interface to PMBusBase in the
phosphor-power-supply code.

Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Change-Id: I6dd8d8a64bdece0d82478450ec83f1aefcae4c75
diff --git a/pmbus.hpp b/pmbus.hpp
index 4635915..89c3118 100644
--- a/pmbus.hpp
+++ b/pmbus.hpp
@@ -110,6 +110,28 @@
 };
 
 /**
+ * @class PMBusBase
+ *
+ * This is a base class for PMBus to assist with unit testing via mocking.
+ */
+class PMBusBase
+{
+  public:
+    virtual ~PMBusBase() = default;
+};
+
+/**
+ * Wrapper function for PMBus
+ *
+ * @param[in] bus - I2C bus
+ * @param[in] address - I2C address (as a 2-byte string, e.g. 0069)
+ *
+ * @return PMBusBase pointer
+ */
+std::unique_ptr<PMBusBase> createPMBus(std::uint8_t bus,
+                                       const std::string& address);
+
+/**
  * @class PMBus
  *
  * This class is an interface to communicating with PMBus devices
@@ -119,11 +141,11 @@
  * in the base device directory (the one passed into the constructor),
  * or in the hwmon directory for the device.
  */
-class PMBus
+class PMBus : public PMBusBase
 {
   public:
     PMBus() = delete;
-    ~PMBus() = default;
+    virtual ~PMBus() = default;
     PMBus(const PMBus&) = default;
     PMBus& operator=(const PMBus&) = default;
     PMBus(PMBus&&) = default;
@@ -158,6 +180,17 @@
     }
 
     /**
+     * Wrapper function for PMBus
+     *
+     * @param[in] bus - I2C bus
+     * @param[in] address - I2C address (as a 2-byte string, e.g. 0069)
+     *
+     * @return PMBusBase pointer
+     */
+    static std::unique_ptr<PMBusBase> createPMBus(std::uint8_t bus,
+                                                  const std::string& address);
+
+    /**
      * Reads a file in sysfs that represents a single bit,
      * therefore doing a PMBus read.
      *