blob: 73e831a4dd9e8846a22994e7846005310585db38 [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
Shawn McCarneyea7385b2019-11-07 12:19:32 -060020namespace phosphor::power::regulators
Shawn McCarneya2461b32019-10-24 18:53:01 -050021{
22
23/**
24 * @class Rule
25 *
26 * A rule is a sequence of actions that can be shared by multiple voltage
27 * regulators.
28 *
29 * Rules define a standard way to perform an operation. For example, the
30 * following action sequences might be sharable using a rule:
31 * - Actions that set the output voltage of a regulator rail
32 * - Actions that read all the sensors of a regulator rail
33 * - Actions that detect down-level hardware using version registers
34 */
35class Rule
36{
37 public:
38 // Specify which compiler-generated methods we want
39 Rule() = delete;
40 Rule(const Rule&) = delete;
41 Rule(Rule&&) = delete;
42 Rule& operator=(const Rule&) = delete;
43 Rule& operator=(Rule&&) = delete;
44 ~Rule() = default;
45
46 /**
47 * Constructor.
48 *
49 * @param id unique rule ID
50 */
Shawn McCarney36d8b7d2019-10-28 14:06:12 -050051 explicit Rule(const std::string& id) : id{id}
Shawn McCarneya2461b32019-10-24 18:53:01 -050052 {
53 }
54
55 /**
56 * Returns the unique ID of this rule.
57 *
58 * @return rule ID
59 */
Shawn McCarney4afb2852019-10-27 18:28:53 -050060 const std::string& getID() const
Shawn McCarneya2461b32019-10-24 18:53:01 -050061 {
62 return id;
63 }
64
65 private:
66 /**
67 * Unique ID of this rule.
68 */
69 const std::string id{};
70};
71
Shawn McCarneyea7385b2019-11-07 12:19:32 -060072} // namespace phosphor::power::regulators