From 023ee9d106760070dd0c1f22119c1831844b3b8f Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 4 Jan 2013 09:53:04 -0800 Subject: [PATCH] cyclegraph: add putNode() helper --- cyclegraph.cc | 18 ++++++++++++++---- cyclegraph.h | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/cyclegraph.cc b/cyclegraph.cc index 168ad90..672a398 100644 --- a/cyclegraph.cc +++ b/cyclegraph.cc @@ -20,6 +20,19 @@ CycleGraph::~CycleGraph() delete discovered; } +/** + * Add a CycleNode to the graph, corresponding to a store ModelAction + * @param act The write action that should be added + * @param node The CycleNode that corresponds to the store + */ +void CycleGraph::putNode(const ModelAction *act, CycleNode *node) +{ + actionToNode.put(act, node); +#if SUPPORT_MOD_ORDER_DUMP + nodeList.push_back(node); +#endif +} + /** * @brief Returns the CycleNode corresponding to a given ModelAction * @param action The ModelAction to find a node for @@ -30,10 +43,7 @@ CycleNode * CycleGraph::getNode(const ModelAction *action) CycleNode *node = actionToNode.get(action); if (node == NULL) { node = new CycleNode(action); - actionToNode.put(action, node); -#if SUPPORT_MOD_ORDER_DUMP - nodeList.push_back(node); -#endif + putNode(action, node); } return node; } diff --git a/cyclegraph.h b/cyclegraph.h index dcdeb3f..6b3d93e 100644 --- a/cyclegraph.h +++ b/cyclegraph.h @@ -40,6 +40,7 @@ class CycleGraph { SNAPSHOTALLOC private: + void putNode(const ModelAction *act, CycleNode *node); CycleNode * getNode(const ModelAction *); HashTable *discovered; -- 2.34.1