Shawn McCarney | a2461b3 | 2019-10-24 18:53:01 -0500 | [diff] [blame] | 1 | /** |
| 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 | |
Shawn McCarney | ea7385b | 2019-11-07 12:19:32 -0600 | [diff] [blame] | 20 | namespace phosphor::power::regulators |
Shawn McCarney | a2461b3 | 2019-10-24 18:53:01 -0500 | [diff] [blame] | 21 | { |
| 22 | |
| 23 | /** |
| 24 | * @class Device |
| 25 | * |
| 26 | * A hardware device, such as a voltage regulator or I/O expander. |
| 27 | */ |
| 28 | class Device |
| 29 | { |
| 30 | public: |
| 31 | // Specify which compiler-generated methods we want |
| 32 | Device() = delete; |
| 33 | Device(const Device&) = delete; |
| 34 | Device(Device&&) = delete; |
| 35 | Device& operator=(const Device&) = delete; |
| 36 | Device& operator=(Device&&) = delete; |
| 37 | ~Device() = default; |
| 38 | |
| 39 | /** |
| 40 | * Constructor. |
| 41 | * |
| 42 | * @param id unique device ID |
| 43 | */ |
Shawn McCarney | 36d8b7d | 2019-10-28 14:06:12 -0500 | [diff] [blame] | 44 | explicit Device(const std::string& id) : id{id} |
Shawn McCarney | a2461b3 | 2019-10-24 18:53:01 -0500 | [diff] [blame] | 45 | { |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Returns the unique ID of this device. |
| 50 | * |
| 51 | * @return device ID |
| 52 | */ |
Shawn McCarney | 4afb285 | 2019-10-27 18:28:53 -0500 | [diff] [blame] | 53 | const std::string& getID() const |
Shawn McCarney | a2461b3 | 2019-10-24 18:53:01 -0500 | [diff] [blame] | 54 | { |
| 55 | return id; |
| 56 | } |
| 57 | |
| 58 | private: |
| 59 | /** |
| 60 | * Unique ID of this device. |
| 61 | */ |
| 62 | const std::string id{}; |
| 63 | }; |
| 64 | |
Shawn McCarney | ea7385b | 2019-11-07 12:19:32 -0600 | [diff] [blame] | 65 | } // namespace phosphor::power::regulators |