blob: 5f443b5cc31081d6158fedd7a26c1b00b3cfca3d [file] [log] [blame]
Shawn McCarneya2461b32019-10-24 18:53:01 -05001/**
2 * Copyright © 2019 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17
18#include <string>
19
20namespace phosphor
21{
22namespace power
23{
24namespace regulators
25{
26
27/**
28 * @class Device
29 *
30 * A hardware device, such as a voltage regulator or I/O expander.
31 */
32class Device
33{
34 public:
35 // Specify which compiler-generated methods we want
36 Device() = delete;
37 Device(const Device&) = delete;
38 Device(Device&&) = delete;
39 Device& operator=(const Device&) = delete;
40 Device& operator=(Device&&) = delete;
41 ~Device() = default;
42
43 /**
44 * Constructor.
45 *
46 * @param id unique device ID
47 */
Shawn McCarney36d8b7d2019-10-28 14:06:12 -050048 explicit Device(const std::string& id) : id{id}
Shawn McCarneya2461b32019-10-24 18:53:01 -050049 {
50 }
51
52 /**
53 * Returns the unique ID of this device.
54 *
55 * @return device ID
56 */
Shawn McCarney4afb2852019-10-27 18:28:53 -050057 const std::string& getID() const
Shawn McCarneya2461b32019-10-24 18:53:01 -050058 {
59 return id;
60 }
61
62 private:
63 /**
64 * Unique ID of this device.
65 */
66 const std::string id{};
67};
68
69} // namespace regulators
70} // namespace power
71} // namespace phosphor