1 #pragma once 2 3 #include <analyzer/callout.hpp> 4 #include <hei_main.hpp> 5 #include <nlohmann/json.hpp> 6 7 namespace analyzer 8 { 9 10 /** 11 * @brief Data regarding required service actions based on the hardware error 12 * analysis. 13 */ 14 class ServiceData 15 { 16 public: 17 /** 18 * @brief Constructor from components. 19 * @param The signature of the root cause attention. 20 * @param True if the signature list contained a system checkstop attention. 21 * False, otherwise. 22 */ 23 ServiceData(const libhei::Signature& i_rootCause, bool i_isCheckstop) : 24 iv_rootCause(i_rootCause), iv_isCheckstop(i_isCheckstop) 25 {} 26 27 /** @brief Destructor. */ 28 ~ServiceData() = default; 29 30 /** @brief Copy constructor. */ 31 ServiceData(const ServiceData&) = default; 32 33 /** @brief Assignment operator. */ 34 ServiceData& operator=(const ServiceData&) = default; 35 36 private: 37 /** The signature of the root cause attention. */ 38 const libhei::Signature iv_rootCause; 39 40 /** True if the signature list contained a system checkstop attention. 41 * False, otherwise. */ 42 const bool iv_isCheckstop; 43 44 /** The list of callouts that will be added to a PEL. */ 45 nlohmann::json iv_calloutList = nlohmann::json::array(); 46 47 /** FFDC for callouts that would otherwise not be available in the 48 * callout list (unit paths, bus types, etc.). */ 49 nlohmann::json iv_calloutFFDC = nlohmann::json::array(); 50 51 public: 52 /** @return The signature of the root cause attention. */ 53 const libhei::Signature& getRootCause() const 54 { 55 return iv_rootCause; 56 } 57 58 /** @return True if the signature list contained a system checkstop 59 * attention. False, otherwise. */ 60 bool queryCheckstop() const 61 { 62 return iv_isCheckstop; 63 } 64 65 /** @return Returns the guard type based on current analysis policies. */ 66 callout::GuardType queryGuardPolicy() const 67 { 68 // TODO: Manual execution of the analyzer (i.e. from the command line), 69 // will eventually require the ability to not guard. This is 70 // useful when we simply want to check for attentions in the 71 // hardware with no service action. 72 73 return queryCheckstop() ? callout::GuardType::UNRECOVERABLE 74 : callout::GuardType::PREDICTIVE; 75 } 76 77 /** 78 * @brief Add callout information to the callout list. 79 * @param The JSON object for this callout. 80 */ 81 void addCallout(const nlohmann::json& i_callout); 82 83 /** 84 * @brief Add FFDC for a callout that would otherwise not be available in 85 * the callout list (unit paths, bus types, etc.). 86 * @param The JSON object for this callout. 87 */ 88 void addCalloutFFDC(const nlohmann::json& i_ffdc) 89 { 90 iv_calloutFFDC.push_back(i_ffdc); 91 } 92 93 /** @brief Accessor to iv_calloutList. */ 94 const nlohmann::json& getCalloutList() const 95 { 96 return iv_calloutList; 97 } 98 99 /** @brief Accessor to iv_calloutFFDC. */ 100 const nlohmann::json& getCalloutFFDC() const 101 { 102 return iv_calloutFFDC; 103 } 104 }; 105 106 } // namespace analyzer 107