Add Device base class.
This is the base class for devices that will be
monitored for faults.
Change-Id: I3c8f60ae7937d92db1c12423f4184f6ad739ac6d
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/device.hpp b/device.hpp
new file mode 100644
index 0000000..5378d8d
--- /dev/null
+++ b/device.hpp
@@ -0,0 +1,80 @@
+#pragma once
+
+#include <memory>
+#include <string>
+
+namespace witherspoon
+{
+namespace power
+{
+
+/**
+ * @class Device
+ *
+ * This object is an abstract base class for a device that
+ * can be monitored for power faults.
+ */
+class Device
+{
+ public:
+
+ Device() = delete;
+ virtual ~Device() = default;
+ Device(const Device&) = delete;
+ Device& operator=(const Device&) = delete;
+ Device(Device&&) = default;
+ Device& operator=(Device&&) = default;
+
+ /**
+ * Constructor
+ *
+ * @param name - the device name
+ * @param inst - the device instance
+ */
+ Device(const std::string& name, size_t inst) :
+ name(name),
+ instance(inst)
+ {
+ }
+
+ /**
+ * Returns the instance number
+ */
+ inline auto getInstance() const
+ {
+ return instance;
+ }
+
+ /**
+ * Returns the name
+ */
+ inline auto getName() const
+ {
+ return name;
+ }
+
+ /**
+ * Pure virtual function to analyze an error
+ */
+ virtual void analyze() = 0;
+
+ /**
+ * Pure virtual function to clear faults on the device
+ */
+ virtual void clearFaults() = 0;
+
+ private:
+
+ /**
+ * the device name
+ */
+ const std::string name;
+
+ /**
+ * the device instance number
+ */
+ const size_t instance;
+};
+
+}
+}