Zane Shelley | f685afd | 2021-02-15 15:39:44 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Zane Shelley | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 3 | #include <analyzer/analyzer_main.hpp> |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 4 | #include <analyzer/callout.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 | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 21 | * @param The type of analysis to perform. |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 22 | */ |
Zane Shelley | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 23 | ServiceData(const libhei::Signature& i_rootCause, |
| 24 | AnalysisType i_analysisType) : |
| 25 | iv_rootCause(i_rootCause), |
| 26 | iv_analysisType(i_analysisType) |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 27 | {} |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 28 | |
| 29 | /** @brief Destructor. */ |
| 30 | ~ServiceData() = default; |
| 31 | |
| 32 | /** @brief Copy constructor. */ |
| 33 | ServiceData(const ServiceData&) = default; |
| 34 | |
| 35 | /** @brief Assignment operator. */ |
| 36 | ServiceData& operator=(const ServiceData&) = default; |
| 37 | |
| 38 | private: |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 39 | /** The signature of the root cause attention. */ |
| 40 | const libhei::Signature iv_rootCause; |
| 41 | |
Zane Shelley | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 42 | /** The type of analysis to perform. */ |
| 43 | const AnalysisType iv_analysisType; |
Zane Shelley | ca49619 | 2021-08-09 12:05:52 -0500 | [diff] [blame] | 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 | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 52 | public: |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 53 | /** @return The signature of the root cause attention. */ |
| 54 | const libhei::Signature& getRootCause() const |
| 55 | { |
| 56 | return iv_rootCause; |
| 57 | } |
| 58 | |
Zane Shelley | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 59 | /** @return The type of analysis to perform. */ |
| 60 | AnalysisType getAnalysisType() const |
Zane Shelley | ca49619 | 2021-08-09 12:05:52 -0500 | [diff] [blame] | 61 | { |
Zane Shelley | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 62 | return iv_analysisType; |
Zane Shelley | ca49619 | 2021-08-09 12:05:52 -0500 | [diff] [blame] | 63 | } |
| 64 | |
Zane Shelley | bf3326f | 2021-11-12 13:41:39 -0600 | [diff] [blame] | 65 | /** @return Returns the guard type based on current analysis policies. */ |
| 66 | callout::GuardType queryGuardPolicy() const |
| 67 | { |
Zane Shelley | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 68 | if (AnalysisType::SYSTEM_CHECKSTOP == iv_analysisType) |
| 69 | { |
| 70 | return callout::GuardType::UNRECOVERABLE; |
| 71 | } |
| 72 | else if (AnalysisType::TERMINATE_IMMEDIATE == iv_analysisType) |
| 73 | { |
| 74 | return callout::GuardType::PREDICTIVE; |
| 75 | } |
Zane Shelley | bf3326f | 2021-11-12 13:41:39 -0600 | [diff] [blame] | 76 | |
Zane Shelley | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 77 | return callout::GuardType::NONE; |
Zane Shelley | bf3326f | 2021-11-12 13:41:39 -0600 | [diff] [blame] | 78 | } |
| 79 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 80 | /** |
| 81 | * @brief Add callout information to the callout list. |
| 82 | * @param The JSON object for this callout. |
| 83 | */ |
Zane Shelley | 979e287 | 2021-09-20 22:46:06 -0500 | [diff] [blame] | 84 | void addCallout(const nlohmann::json& i_callout); |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 85 | |
Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame] | 86 | /** |
Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 87 | * @brief Add FFDC for a callout that would otherwise not be available in |
| 88 | * the callout list (unit paths, bus types, etc.). |
| 89 | * @param The JSON object for this callout. |
| 90 | */ |
| 91 | void addCalloutFFDC(const nlohmann::json& i_ffdc) |
| 92 | { |
| 93 | iv_calloutFFDC.push_back(i_ffdc); |
| 94 | } |
| 95 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 96 | /** @brief Accessor to iv_calloutList. */ |
| 97 | const nlohmann::json& getCalloutList() const |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 98 | { |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 99 | return iv_calloutList; |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 100 | } |
Zane Shelley | 5f6e3de | 2021-02-23 13:57:37 -0600 | [diff] [blame] | 101 | |
Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 102 | /** @brief Accessor to iv_calloutFFDC. */ |
| 103 | const nlohmann::json& getCalloutFFDC() const |
| 104 | { |
| 105 | return iv_calloutFFDC; |
| 106 | } |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 107 | }; |
| 108 | |
Zane Shelley | f685afd | 2021-02-15 15:39:44 -0600 | [diff] [blame] | 109 | } // namespace analyzer |