blob: 06812a58eb77d9f5ff46f7194c049142d0c3cff6 [file] [log] [blame]
Zane Shelleyc85716c2021-08-17 10:54:06 -05001#pragma once
2
3#include <string>
4
5namespace analyzer
6{
7
8namespace callout
9{
10
11/** @brief All callouts will have a priority indicating when to issue the
12 * required service action. */
13class Priority
14{
15 public:
16 /** Serivce is mandatory. */
17 static const Priority HIGH;
18
19 /** Serivce medium priority callouts one at a time, in order, until the
20 * issue is resolved. */
21 static const Priority MED;
22
23 /** Same as MED, except replace all A's as a group. */
24 static const Priority MED_A;
25
26 /** Same as MED, except replace all A's as a group. */
27 static const Priority MED_B;
28
29 /** Same as MED, except replace all A's as a group. */
30 static const Priority MED_C;
31
32 /** If servicing all high and medium priority callouts did not resolve
33 * the issue, service low priority callouts one at a time, in order,
34 * until the issue is resolved. */
35 static const Priority LOW;
36
37 private:
38 /**
39 * @brief Constructor from components.
40 *
41 * At the moment, the priority values for the callout list user data
42 * section are different from the priority values hard-coded in the
43 * registry. Therefore, two different values must be stored.
44 *
45 * @param i_registry The string representation of a priority used in
46 * registry callouts.
47 * @param i_userData The string representation of a priority used in user
48 * data callouts.
49 */
50 Priority(const std::string& i_registry, const std::string& i_userData) :
51 iv_registry(i_registry), iv_userData(i_userData)
52 {}
53
54 private:
55 /** The string representation of a priority used in registry callouts. */
56 const std::string iv_registry;
57
58 /** The string representation of a priority used in user data callouts. */
59 const std::string iv_userData;
60
61 public:
62 /** iv_registry accessor */
63 const std::string& getRegistryString() const
64 {
65 return iv_registry;
66 }
67
68 /** iv_userData accessor */
69 const std::string& getUserDataString() const
70 {
71 return iv_userData;
72 }
73};
74
75// clang-format off
76inline const Priority Priority::HIGH {"high", "H"};
77inline const Priority Priority::MED {"medium", "M"};
78inline const Priority Priority::MED_A{"medium_group_A","A"};
79inline const Priority Priority::MED_B{"medium_group_B","B"};
80inline const Priority Priority::MED_C{"medium_group_C","C"};
81inline const Priority Priority::LOW {"low", "L"};
82// clang-format on
83
84/** @brief Container class for procedure callout service actions. */
85class Procedure
86{
87 public:
88 /** Contact next level support. */
89 static const Procedure NEXTLVL;
90
91 private:
92 /**
93 * @brief Constructor from components.
94 * @param i_string The string representation of the procedure used for
95 * callouts.
96 */
97 explicit Procedure(const std::string& i_string) : iv_string(i_string) {}
98
99 private:
100 /** The string representation of the procedure used for callouts. */
101 const std::string iv_string;
102
103 public:
104 /** iv_string accessor */
105 std::string getString() const
106 {
107 return iv_string;
108 }
109};
110
Zane Shelley86ccc452021-11-16 13:10:52 -0600111inline const Procedure Procedure::NEXTLVL{"next_level_support"};
Zane Shelleyc85716c2021-08-17 10:54:06 -0500112
Zane Shelley5d63cef2021-09-17 18:10:17 -0500113/** @brief Container class for bus callout service actions. */
114class BusType
115{
116 public:
117 /** SMP bus (fabric A or X bus). */
118 static const BusType SMP_BUS;
119
120 /** OMI bus (memory bus). */
121 static const BusType OMI_BUS;
122
123 private:
124 /**
125 * @brief Constructor from components.
126 * @param i_string The string representation of the procedure used for
127 * callouts.
128 */
129 explicit BusType(const std::string& i_string) : iv_string(i_string) {}
130
131 private:
132 /** The string representation of the procedure used for callouts. */
133 const std::string iv_string;
134
135 public:
136 bool operator==(const BusType& r) const
137 {
138 return this->iv_string == r.iv_string;
139 }
140
141 /** iv_string accessor */
142 std::string getString() const
143 {
144 return iv_string;
145 }
146};
147
148inline const BusType BusType::SMP_BUS{"SMP_BUS"};
149inline const BusType BusType::OMI_BUS{"OMI_BUS"};
150
Zane Shelley84721d92021-09-08 13:30:27 -0500151/** @brief Container class for clock callout service actions. */
152class ClockType
153{
154 public:
155 /** Oscillator reference clock 0. */
156 static const ClockType OSC_REF_CLOCK_0;
157
158 /** Oscillator reference clock 1. */
159 static const ClockType OSC_REF_CLOCK_1;
160
161 private:
162 /**
163 * @brief Constructor from components.
164 * @param i_string The string representation of the procedure used for
165 * callouts.
166 */
167 explicit ClockType(const std::string& i_string) : iv_string(i_string) {}
168
169 private:
170 /** The string representation of the procedure used for callouts. */
171 const std::string iv_string;
172
173 public:
174 /** iv_string accessor */
175 std::string getString() const
176 {
177 return iv_string;
178 }
179};
180
181inline const ClockType ClockType::OSC_REF_CLOCK_0{"OSC_REF_CLOCK_0"};
182inline const ClockType ClockType::OSC_REF_CLOCK_1{"OSC_REF_CLOCK_1"};
183
Zane Shelleybf3326f2021-11-12 13:41:39 -0600184/** @brief Container class for guard service actions. */
185class GuardType
186{
187 public:
188 /** Do not guard. */
189 static const GuardType NONE;
190
191 /** Guard on fatal error (cannot recover resource). */
192 static const GuardType UNRECOVERABLE;
193
194 /** Guard on non-fatal error (can recover resource). */
195 static const GuardType PREDICTIVE;
196
197 private:
198 /**
199 * @brief Constructor from components.
200 * @param i_string The string representation of the procedure used for
201 * callouts.
202 */
203 explicit GuardType(const std::string& i_string) : iv_string(i_string) {}
204
205 private:
206 /** The string representation of the procedure used for callouts. */
207 const std::string iv_string;
208
209 public:
210 bool operator==(const GuardType& r) const
211 {
212 return this->iv_string == r.iv_string;
213 }
214
215 /** iv_string accessor */
216 std::string getString() const
217 {
218 return iv_string;
219 }
220};
221
222inline const GuardType GuardType::NONE{"GARD_NULL"};
223inline const GuardType GuardType::UNRECOVERABLE{"GARD_Unrecoverable"};
224inline const GuardType GuardType::PREDICTIVE{"GARD_Predictive"};
225
Zane Shelleyc85716c2021-08-17 10:54:06 -0500226} // namespace callout
227
228} // namespace analyzer