| Zane Shelley | f685afd | 2021-02-15 15:39:44 -0600 | [diff] [blame] | 1 | #pragma once | 
 | 2 |  | 
| Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 3 | #include <analyzer/callout.hpp> | 
| Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame] | 4 | #include <analyzer/guard.hpp> | 
| Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 5 | #include <hei_main.hpp> | 
| Zane Shelley | f685afd | 2021-02-15 15:39:44 -0600 | [diff] [blame] | 6 | #include <nlohmann/json.hpp> | 
 | 7 |  | 
 | 8 | namespace analyzer | 
 | 9 | { | 
 | 10 |  | 
| Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 11 | /** | 
 | 12 |  * @brief Data regarding required service actions based on the hardware error | 
 | 13 |  *        analysis. | 
 | 14 |  */ | 
 | 15 | class ServiceData | 
 | 16 | { | 
 | 17 |   public: | 
| Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 18 |     /** | 
 | 19 |      * @brief Constructor from components. | 
 | 20 |      * @param The signature of the root cause attention. | 
| Zane Shelley | ca49619 | 2021-08-09 12:05:52 -0500 | [diff] [blame] | 21 |      * @param True if the signature list contained a system checkstop attention. | 
 | 22 |      *        False, otherwise. | 
| Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 23 |      */ | 
| Zane Shelley | ca49619 | 2021-08-09 12:05:52 -0500 | [diff] [blame] | 24 |     ServiceData(const libhei::Signature& i_rootCause, bool i_isCheckstop) : | 
 | 25 |         iv_rootCause(i_rootCause), iv_isCheckstop(i_isCheckstop) | 
| Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 26 |     {} | 
| Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 27 |  | 
 | 28 |     /** @brief Destructor. */ | 
 | 29 |     ~ServiceData() = default; | 
 | 30 |  | 
 | 31 |     /** @brief Copy constructor. */ | 
 | 32 |     ServiceData(const ServiceData&) = default; | 
 | 33 |  | 
 | 34 |     /** @brief Assignment operator. */ | 
 | 35 |     ServiceData& operator=(const ServiceData&) = default; | 
 | 36 |  | 
 | 37 |   private: | 
| Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 38 |     /** The signature of the root cause attention. */ | 
 | 39 |     const libhei::Signature iv_rootCause; | 
 | 40 |  | 
| Zane Shelley | ca49619 | 2021-08-09 12:05:52 -0500 | [diff] [blame] | 41 |     /** True if the signature list contained a system checkstop attention. | 
 | 42 |      *  False, otherwise. */ | 
 | 43 |     const bool iv_isCheckstop; | 
 | 44 |  | 
| Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 45 |     /** The list of callouts that will be added to a PEL. */ | 
| Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 46 |     nlohmann::json iv_calloutList = nlohmann::json::array(); | 
| Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 47 |  | 
| Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 48 |     /** FFDC for callouts that would otherwise not be available in the | 
 | 49 |      *  callout list (unit paths, bus types, etc.). */ | 
 | 50 |     nlohmann::json iv_calloutFFDC = nlohmann::json::array(); | 
 | 51 |  | 
| Zane Shelley | 5f6e3de | 2021-02-23 13:57:37 -0600 | [diff] [blame] | 52 |     /** The list of hardware guard requests. Some information will be added to | 
| Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame] | 53 |      *  the PEL, but the actual guard record will be created after submitting | 
 | 54 |      *  the PEL. */ | 
 | 55 |     std::vector<Guard> iv_guardList; | 
| Zane Shelley | 5f6e3de | 2021-02-23 13:57:37 -0600 | [diff] [blame] | 56 |  | 
| Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 57 |   public: | 
| Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 58 |     /** @return The signature of the root cause attention. */ | 
 | 59 |     const libhei::Signature& getRootCause() const | 
 | 60 |     { | 
 | 61 |         return iv_rootCause; | 
 | 62 |     } | 
 | 63 |  | 
| Zane Shelley | ca49619 | 2021-08-09 12:05:52 -0500 | [diff] [blame] | 64 |     /** @return True if the signature list contained a system checkstop | 
 | 65 |      *          attention. False, otherwise. */ | 
 | 66 |     bool queryCheckstop() const | 
 | 67 |     { | 
 | 68 |         return iv_isCheckstop; | 
 | 69 |     } | 
 | 70 |  | 
| Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 71 |     /** | 
 | 72 |      * @brief Add callout information to the callout list. | 
 | 73 |      * @param The JSON object for this callout. | 
 | 74 |      */ | 
 | 75 |     void addCallout(const nlohmann::json& i_callout) | 
| Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 76 |     { | 
 | 77 |         iv_calloutList.push_back(i_callout); | 
 | 78 |     } | 
 | 79 |  | 
| Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame] | 80 |     /** | 
| Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 81 |      * @brief Add FFDC for a callout that would otherwise not be available in | 
 | 82 |      *        the callout list (unit paths, bus types, etc.). | 
 | 83 |      * @param The JSON object for this callout. | 
 | 84 |      */ | 
 | 85 |     void addCalloutFFDC(const nlohmann::json& i_ffdc) | 
 | 86 |     { | 
 | 87 |         iv_calloutFFDC.push_back(i_ffdc); | 
 | 88 |     } | 
 | 89 |  | 
 | 90 |     /** | 
| Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame] | 91 |      * @brief  Add a guard request to the guard list. | 
 | 92 |      * @param  i_path  Entity path for the target part. | 
 | 93 |      * @param  i_guard True, if the part should be guarded. False, otherwise. | 
| Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 94 |      * @return A reference to the object just added to the guard list. | 
| Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame] | 95 |      */ | 
| Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 96 |     const Guard& addGuard(const std::string& i_path, bool i_guard) | 
| Zane Shelley | 5f6e3de | 2021-02-23 13:57:37 -0600 | [diff] [blame] | 97 |     { | 
| Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame] | 98 |         Guard::Type guardType = Guard::Type::NONE; | 
 | 99 |         if (i_guard) | 
 | 100 |         { | 
 | 101 |             // The guard type is dependent on the presence of a system checkstop | 
 | 102 |             // attention. | 
 | 103 |             guardType = | 
 | 104 |                 queryCheckstop() ? Guard::Type::FATAL : Guard::Type::NON_FATAL; | 
 | 105 |         } | 
 | 106 |  | 
| Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 107 |         return iv_guardList.emplace_back(i_path, guardType); | 
| Zane Shelley | 5f6e3de | 2021-02-23 13:57:37 -0600 | [diff] [blame] | 108 |     } | 
 | 109 |  | 
| Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 110 |     /** @brief Accessor to iv_calloutList. */ | 
 | 111 |     const nlohmann::json& getCalloutList() const | 
| Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 112 |     { | 
| Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 113 |         return iv_calloutList; | 
| Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 114 |     } | 
| Zane Shelley | 5f6e3de | 2021-02-23 13:57:37 -0600 | [diff] [blame] | 115 |  | 
| Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 116 |     /** @brief Accessor to iv_calloutFFDC. */ | 
 | 117 |     const nlohmann::json& getCalloutFFDC() const | 
 | 118 |     { | 
 | 119 |         return iv_calloutFFDC; | 
 | 120 |     } | 
 | 121 |  | 
| Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame] | 122 |     /** @brief Accessor to iv_guardList. */ | 
 | 123 |     const std::vector<Guard>& getGuardList() const | 
| Zane Shelley | 5f6e3de | 2021-02-23 13:57:37 -0600 | [diff] [blame] | 124 |     { | 
| Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame] | 125 |         return iv_guardList; | 
| Zane Shelley | 5f6e3de | 2021-02-23 13:57:37 -0600 | [diff] [blame] | 126 |     } | 
| Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 127 | }; | 
 | 128 |  | 
| Zane Shelley | f685afd | 2021-02-15 15:39:44 -0600 | [diff] [blame] | 129 | } // namespace analyzer |