1 #pragma once
2 
3 #include <string>
4 
5 namespace analyzer
6 {
7 
8 namespace callout
9 {
10 
11 /** @brief All callouts will have a priority indicating when to issue the
12  *         required service action. */
13 class 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
76 inline const Priority Priority::HIGH {"high",          "H"};
77 inline const Priority Priority::MED  {"medium",        "M"};
78 inline const Priority Priority::MED_A{"medium_group_A","A"};
79 inline const Priority Priority::MED_B{"medium_group_B","B"};
80 inline const Priority Priority::MED_C{"medium_group_C","C"};
81 inline const Priority Priority::LOW  {"low",           "L"};
82 // clang-format on
83 
84 /** @brief Container class for procedure callout service actions. */
85 class 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 
111 inline const Procedure Procedure::NEXTLVL{"next_level_support"};
112 
113 /** @brief Container class for bus callout service actions. */
114 class 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 
148 inline const BusType BusType::SMP_BUS{"SMP_BUS"};
149 inline const BusType BusType::OMI_BUS{"OMI_BUS"};
150 
151 /** @brief Container class for clock callout service actions. */
152 class 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 
181 inline const ClockType ClockType::OSC_REF_CLOCK_0{"OSC_REF_CLOCK_0"};
182 inline const ClockType ClockType::OSC_REF_CLOCK_1{"OSC_REF_CLOCK_1"};
183 
184 /** @brief Container class for guard service actions. */
185 class 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 
222 inline const GuardType GuardType::NONE{"GARD_NULL"};
223 inline const GuardType GuardType::UNRECOVERABLE{"GARD_Unrecoverable"};
224 inline const GuardType GuardType::PREDICTIVE{"GARD_Predictive"};
225 
226 } // namespace callout
227 
228 } // namespace analyzer
229