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     /**
66      * @brief Add callout information to the callout list.
67      * @param The JSON object for this callout.
68      */
69     void addCallout(const nlohmann::json& i_callout);
70 
71     /**
72      * @brief Add FFDC for a callout that would otherwise not be available in
73      *        the callout list (unit paths, bus types, etc.).
74      * @param The JSON object for this callout.
75      */
76     void addCalloutFFDC(const nlohmann::json& i_ffdc)
77     {
78         iv_calloutFFDC.push_back(i_ffdc);
79     }
80 
81     /** @brief Accessor to iv_calloutList. */
82     const nlohmann::json& getCalloutList() const
83     {
84         return iv_calloutList;
85     }
86 
87     /** @brief Accessor to iv_calloutFFDC. */
88     const nlohmann::json& getCalloutFFDC() const
89     {
90         return iv_calloutFFDC;
91     }
92 };
93 
94 } // namespace analyzer
95