blob: 5378d8d387c9c01cc16eb05c6383ccd5c71be6ed [file] [log] [blame]
Matt Spinlerdae0a8d2017-07-24 13:42:55 -05001#pragma once
2
3#include <memory>
4#include <string>
5
6namespace witherspoon
7{
8namespace power
9{
10
11/**
12 * @class Device
13 *
14 * This object is an abstract base class for a device that
15 * can be monitored for power faults.
16 */
17class Device
18{
19 public:
20
21 Device() = delete;
22 virtual ~Device() = default;
23 Device(const Device&) = delete;
24 Device& operator=(const Device&) = delete;
25 Device(Device&&) = default;
26 Device& operator=(Device&&) = default;
27
28 /**
29 * Constructor
30 *
31 * @param name - the device name
32 * @param inst - the device instance
33 */
34 Device(const std::string& name, size_t inst) :
35 name(name),
36 instance(inst)
37 {
38 }
39
40 /**
41 * Returns the instance number
42 */
43 inline auto getInstance() const
44 {
45 return instance;
46 }
47
48 /**
49 * Returns the name
50 */
51 inline auto getName() const
52 {
53 return name;
54 }
55
56 /**
57 * Pure virtual function to analyze an error
58 */
59 virtual void analyze() = 0;
60
61 /**
62 * Pure virtual function to clear faults on the device
63 */
64 virtual void clearFaults() = 0;
65
66 private:
67
68 /**
69 * the device name
70 */
71 const std::string name;
72
73 /**
74 * the device instance number
75 */
76 const size_t instance;
77};
78
79}
80}