Add GPIO class

This class will be used for accessing GPIOs off of the
UCD90160 to check for PGOOD faults, and also later for
isolating GPU overtemps and PGOOD faults down to the specific
GPU that failed.

The FileDescriptor class is used by the GPIO class to manage
the lifetime of the GPIO file handles.

The class only supports reading a GPIO value.  At this point
there is no requirement for doing writes.

This class was copied from phosphor-gpio-monitor/gpio-util.

Change-Id: Iee276aed67e1cba549c3070c08238ab5f621c320
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/file.hpp b/file.hpp
new file mode 100644
index 0000000..5be4c4b
--- /dev/null
+++ b/file.hpp
@@ -0,0 +1,73 @@
+#pragma once
+
+#include <unistd.h>
+namespace witherspoon
+{
+namespace power
+{
+namespace util
+{
+
+/**
+ * @class FileDescriptor
+ *
+ * Closes the file descriptor on destruction
+ */
+class FileDescriptor
+{
+    public:
+
+        FileDescriptor() = default;
+        FileDescriptor(const FileDescriptor&) = delete;
+        FileDescriptor& operator=(const FileDescriptor&) = delete;
+        FileDescriptor(FileDescriptor&&) = delete;
+        FileDescriptor& operator=(FileDescriptor&&) = delete;
+
+        /**
+         * Constructor
+         *
+         * @param[in] fd - File descriptor
+         */
+        FileDescriptor(int fd) : fd(fd)
+        {
+        }
+
+        ~FileDescriptor()
+        {
+            if (fd >= 0)
+            {
+                close(fd);
+            }
+        }
+
+        int operator()()
+        {
+            return fd;
+        }
+
+        operator bool() const
+        {
+            return fd != -1;
+        }
+
+        void set(int descriptor)
+        {
+            if (fd >= 0)
+            {
+                close(fd);
+            }
+
+            fd = descriptor;
+        }
+
+    private:
+
+        /**
+         * File descriptor
+         */
+        int fd = -1;
+};
+
+}
+}
+}