Created Signature class and added to isolation data

Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I84653e1daa2b27327586817af5eb42de61bc37fa
diff --git a/src/hei_isolation_data.hpp b/src/hei_isolation_data.hpp
index 0117ce5..ee1432d 100644
--- a/src/hei_isolation_data.hpp
+++ b/src/hei_isolation_data.hpp
@@ -1,6 +1,7 @@
 #pragma once
 
 #include <hei_includes.hpp>
+#include <isolator/hei_signature.hpp>
 
 namespace libhei
 {
@@ -13,7 +14,7 @@
  */
 class IsolationData
 {
-  public:
+  public: // Constructors, destructor, assignment, etc.
 
     /** @brief Default constructor. */
     IsolationData() = default;
@@ -27,12 +28,35 @@
     /** @brief Assignment operator. */
     IsolationData & operator=( const IsolationData & ) = default;
 
-    /** @brief Flushes the data to ensure a clean slate for next isolation. */
-    void clear() {}
+  private: // Instance variables
 
-  private:
+    /** A list of all signatures found during isolation. */
+    std::vector<Signature> iv_sigLists;
 
-    // TODO: add error signature list and register dump.
+    // TODO: add register dump.
+
+  public: // Member functions
+
+    /**
+     * @brief Adds a signature to the signature list.
+     * @param i_signature The target signature.
+     */
+    void addSignature( const Signature & i_signature )
+    {
+        iv_sigLists.push_back( i_signature );
+    }
+
+    /** @brief Allows access to the signature list. */
+    const std::vector<Signature> & getSignatureList()
+    {
+        return iv_sigLists;
+    }
+
+    /** @brief Flushes the data to ensure a clean slate for isolation. */
+    void flush()
+    {
+        iv_sigLists.clear();
+    }
 
 }; // end class IsolationData
 
diff --git a/src/hei_types.hpp b/src/hei_types.hpp
index c7e224c..9accfcb 100644
--- a/src/hei_types.hpp
+++ b/src/hei_types.hpp
@@ -96,6 +96,18 @@
 };
 
 /**
+ * This is used to defined a bit field for a register. It is mainly used in the
+ * Signature class to indicate which bit on a register had an active attention.
+ *
+ * Values:
+ *   The widest supported register is only 64-bits (value 0-63).
+ *
+ * Range:
+ *   Only the minimum 1-byte field is necessary.
+ */
+typedef uint8_t RegisterBit_t;
+
+/**
  * The hardware address of a register (right justified).
  *
  * Values:
@@ -126,5 +138,38 @@
     REG_ACCESS_RW   = 0x3, ///< Read/Write access
 };
 
+/**
+ * The Chip Data Files will contain action, rules, etc. based on the supported
+ * attention types listed in this enum. The user application must use the
+ * values defined in this enum in order to maintain consistency across all
+ * chips.
+ *
+ * Values:
+ *   The supported attention types are listed in this enum.
+ *
+ * Range:
+ *   Only the minimum 1-byte field is necessary.
+ */
+enum AttentionType_t : uint8_t
+{
+    /** System checkstop hardware attention. Unrecoverable, fatal error. */
+    ATTN_TYPE_CHECKSTOP   = 1,
+
+    /** Unit checkstop hardware attention. A unit within the system is no longer
+     *  usable but the rest of the system should be able to recover. */
+    ATTN_TYPE_UNIT_CS     = 2,
+
+    /** Recoverable hardware attention. The system should be able to continue
+     *  uninterrupted, possible degraded functionality. */
+    ATTN_TYPE_RECOVERABLE = 3,
+
+    /** Software or hardware event requiring action by the service processor
+     *  firmware. */
+    ATTN_TYPE_SP_ATTN     = 4,
+
+    /** Software or hardware event requiring action by the host firmware. */
+    ATTN_TYPE_HOST_ATTN   = 5,
+};
+
 } // end namespace libhei
 
diff --git a/src/isolator/hei_isolator.cpp b/src/isolator/hei_isolator.cpp
index 3f75163..404a367 100644
--- a/src/isolator/hei_isolator.cpp
+++ b/src/isolator/hei_isolator.cpp
@@ -55,7 +55,7 @@
     ReturnCode rc;
 
     // Flush the isolation data to ensure a clean slate.
-    o_isoData.clear();
+    o_isoData.flush();
 
     // Flush the hardware register cache to avoid using stale data.
     HardwareRegister::flushAll();
diff --git a/src/isolator/hei_signature.hpp b/src/isolator/hei_signature.hpp
new file mode 100644
index 0000000..018673a
--- /dev/null
+++ b/src/isolator/hei_signature.hpp
@@ -0,0 +1,71 @@
+#pragma once
+
+#include <hei_includes.hpp>
+
+namespace libhei
+{
+
+/**
+ * @brief A signature represents an active attention from a single bit on a
+ *        register within a chip.
+ *
+ * The isolator will gather a list of all active attentions on a chip and return
+ * a list of signatures to the user application. The user application should be
+ * able to determine what actions to take based on these signatures.
+ */
+class Signature
+{
+  public: // Constructors, destructor, assignment, etc.
+
+    /**
+     * @brief Constructor from components.
+     * @param i_chip     The chip containing this register.
+     * @param i_id       The register ID.
+     * @param i_instance The instance of this register.
+     * @param i_bit      The target bit within this register.
+     * @param i_attnType The attention type reported by this bit.
+     */
+    Signature( const Chip & i_chip, RegisterId_t i_id,
+               RegisterInstance_t i_instance, RegisterBit_t i_bit,
+               AttentionType_t i_attnType ) :
+        iv_chip( i_chip ), iv_id( i_id ), iv_instance( i_instance ),
+        iv_bit( i_bit ), iv_attnType( i_attnType )
+    {}
+
+    /** @brief Destructor. */
+    ~Signature() = default;
+
+    /** @brief Copy constructor. */
+    Signature( const Signature & ) = default;
+
+    /** @brief Assignment operator. */
+    Signature & operator=( const Signature & ) = default;
+
+  private: // Instance variables.
+
+    Chip               iv_chip;     ///< Chip containing this register.
+    RegisterId_t       iv_id;       ///< Register ID.
+    RegisterInstance_t iv_instance; ///< Instance of this register.
+    RegisterBit_t      iv_bit;      ///< Target bit within this register.
+    AttentionType_t    iv_attnType; ///< Attention type reported by this bit.
+
+  public: // Member functions
+
+    /** @return The chip containing this register. */
+    const Chip & getChip() const { return iv_chip; }
+
+    /** @return The register ID. */
+    RegisterId_t getId() const { return iv_id; }
+
+    /** @return The instance of this register. */
+    RegisterInstance_t getInstance() const { return iv_instance; }
+
+    /** @return The target bit within this register. */
+    RegisterBit_t getBit() const { return iv_bit; }
+
+    /** @return The attention type reported by this bit. */
+    AttentionType_t getAttnType() const { return iv_attnType; }
+};
+
+} // end namespace libhei
+