Functions to add nodes and regs to IsolationChip class

Change-Id: I3361f23f795b9015235add237bf5a78bd8afa861
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
index ef40564..69bc643 100644
--- a/src/isolator/hei_isolation_chip.cpp
+++ b/src/isolator/hei_isolation_chip.cpp
@@ -27,4 +27,72 @@
 
 //------------------------------------------------------------------------------
 
+void IsolationChip::addHardwareRegister(HardwareRegisterPtr i_hwReg)
+{
+    HEI_ASSERT(i_hwReg); // should not be null
+
+    RegisterKey_t key = {i_hwReg->getId(), i_hwReg->getInstance()};
+
+    auto ret = iv_regs.emplace(key, i_hwReg);
+
+    // If an entry already exists, it should point to the same object.
+    HEI_ASSERT(ret.second || (ret.first->second == i_hwReg));
+}
+
+//------------------------------------------------------------------------------
+
+void IsolationChip::addIsolationNode(IsolationNodePtr i_isoNode)
+{
+    HEI_ASSERT(i_isoNode); // should not be null
+
+    NodeKey_t key = {i_isoNode->getId(), i_isoNode->getInstance()};
+
+    auto ret = iv_nodes.emplace(key, i_isoNode);
+
+    // If an entry already exists, it should point to the same object.
+    HEI_ASSERT(ret.second || (ret.first->second == i_isoNode));
+}
+
+//------------------------------------------------------------------------------
+
+void IsolationChip::addRootNode(AttentionType_t i_attnType,
+                                IsolationNodePtr i_rootNode)
+{
+    HEI_ASSERT(i_rootNode); // should not be null
+
+    auto ret = iv_rootNodes.emplace(i_attnType, i_rootNode);
+
+    // If an entry already exists, it should point to the same object.
+    HEI_ASSERT(ret.second || (ret.first->second == i_rootNode));
+}
+
+//------------------------------------------------------------------------------
+
+HardwareRegisterPtr
+    IsolationChip::getHardwareRegister(RegisterId_t i_regId,
+                                       Instance_t i_regInst) const
+{
+    RegisterKey_t key = {i_regId, i_regInst};
+
+    auto itr = iv_regs.find(key);
+    HEI_ASSERT(iv_regs.end() != itr); // The register should exist.
+
+    return itr->second;
+}
+
+//------------------------------------------------------------------------------
+
+IsolationNodePtr IsolationChip::getIsolationNode(NodeId_t i_nodeId,
+                                                 Instance_t i_nodeInst) const
+{
+    NodeKey_t key = {i_nodeId, i_nodeInst};
+
+    auto itr = iv_nodes.find(key);
+    HEI_ASSERT(iv_nodes.end() != itr); // The node should exist.
+
+    return itr->second;
+}
+
+//------------------------------------------------------------------------------
+
 } // end namespace libhei