Created IsolationChip class

Change-Id: I8c95713303f730c1ee6aa289154be47fc66639db
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
diff --git a/src/isolator/hei_isolation_chip.cpp b/src/isolator/hei_isolation_chip.cpp
new file mode 100644
index 0000000..ef40564
--- /dev/null
+++ b/src/isolator/hei_isolation_chip.cpp
@@ -0,0 +1,30 @@
+#include <isolator/hei_isolation_chip.hpp>
+
+namespace libhei
+{
+
+//------------------------------------------------------------------------------
+
+bool IsolationChip::analyze(const Chip& i_chip, IsolationData& io_isoData) const
+{
+    bool o_activeAttn = false; // Initially, assume no active attentions.
+
+    // The given chip must be the same type as iv_chipType.
+    HEI_ASSERT(iv_chipType == i_chip.getType());
+
+    // Iterate each root node.
+    for (const auto& node : iv_rootNodes)
+    {
+        if (node.second->analyze(i_chip, node.first, io_isoData))
+        {
+            // At least one attention type had an active attention.
+            o_activeAttn = true;
+        }
+    }
+
+    return o_activeAttn;
+}
+
+//------------------------------------------------------------------------------
+
+} // end namespace libhei
diff --git a/src/isolator/hei_isolation_chip.hpp b/src/isolator/hei_isolation_chip.hpp
new file mode 100644
index 0000000..6930955
--- /dev/null
+++ b/src/isolator/hei_isolation_chip.hpp
@@ -0,0 +1,73 @@
+#pragma once
+
+#include <hei_isolation_data.hpp>
+#include <isolator/hei_isolation_node.hpp>
+
+namespace libhei
+{
+
+/**
+ * @brief This class contains all information required to isolate attentions on
+ *        a specific chip type.
+ *
+ * The primary function of this class is analyze(), which will do a depth-first
+ * search of the hardware attention reporting tree structure (characterized by
+ * IsolationNode objects) to find all active attentions on a chip.
+ *
+ * The data for each chip type is built from information in the Chip Data Files.
+ *
+ *  IMPORTANT:
+ *   Most of the objects created and referenced by this class are stored in the
+ *   flyweight factories, which are used as a space saving mechanism by
+ *   preventing duplicate object creation. For example, a large set of the
+ *   registers for a specific chip model will likely be common between each of
+ *   chip level of that model. It is not necessary to create new objects for
+ *   each level when the attributes are all the same. Because the flyweights are
+ *   used, it is not possible to remove all of the data for a specific chip
+ *   model/level be deleting an IsolationChip object. Instead, you must call the
+ *   main uninitialize() function and clear all data for all objects.
+ */
+class IsolationChip
+{
+  public: // Constructors, destructor, assignment
+    /** @brief Default constructor. */
+    IsolationChip(ChipType_t i_chipType, const RootNodeMap& i_rootNodes) :
+        iv_chipType(i_chipType), iv_rootNodes(i_rootNodes)
+    {}
+
+    /** @brief Destructor. */
+    ~IsolationChip() = default;
+
+    /** @brief Copy constructor. */
+    IsolationChip(const IsolationChip&) = delete;
+
+    /** @brief Assignment operator. */
+    IsolationChip& operator=(const IsolationChip&) = delete;
+
+  private: // Instance variables
+    /** This chip's type. */
+    const ChipType_t iv_chipType;
+
+    /** Root nodes for this chip type. */
+    const RootNodeMap iv_rootNodes;
+
+  public: // Member functions
+    /**
+     * @brief  Finds all active attentions on this chip.
+     * @param  i_chip     The target chip for isolation. Will assert the given
+     *                    chip type matches iv_chipType.
+     * @param  io_isoData The isolation data returned back to the user
+     *                    application.
+     * @return True, if any active attentions found on this chip.
+     *         False, otherwise.
+     */
+    bool analyze(const Chip& i_chip, IsolationData& io_isoData) const;
+
+    /** @brief Chip type accessor. */
+    ChipType_t getChipType() const
+    {
+        return iv_chipType;
+    }
+};
+
+} // end namespace libhei
diff --git a/src/isolator/hei_isolation_node.hpp b/src/isolator/hei_isolation_node.hpp
index 86098fc..90aaeb4 100644
--- a/src/isolator/hei_isolation_node.hpp
+++ b/src/isolator/hei_isolation_node.hpp
@@ -181,4 +181,7 @@
     }
 };
 
+/** Simple map to ensure only one root IsolationNode per attention type. */
+using RootNodeMap = std::map<AttentionType_t, const IsolationNode*>;
+
 } // end namespace libhei
diff --git a/test/simulator/meson.build b/test/simulator/meson.build
index 88de4b8..0f96bb3 100644
--- a/test/simulator/meson.build
+++ b/test/simulator/meson.build
@@ -7,6 +7,7 @@
 # Isolator sources
 iso_src = [
     '../../src/isolator/hei_isolator.cpp',
+    '../../src/isolator/hei_isolation_chip.cpp',
     '../../src/isolator/hei_isolation_node.cpp',
     '../../src/register/hei_hardware_register.cpp',
     '../../src/util/hei_bit_string.cpp',