}
/**
+ * @brief Returns a CycleNode corresponding to a promise
+ *
+ * Gets (or creates, if none exist) a CycleNode corresponding to a promised
+ * value.
+ *
+ * @param promise The Promise generated by a reader
+ * @return The CycleNode corresponding to the Promise
+ */
+CycleNode * CycleGraph::getNode(const Promise *promise)
+{
+ const ModelAction *reader = promise->get_action();
+ CycleNode *node = readerToPromiseNode.get(reader);
+ if (node == NULL) {
+ node = new CycleNode(promise);
+ readerToPromiseNode.put(reader, node);
+ }
+ return node;
+}
+
+/*
* @brief Adds an edge between objects
*
* This function will add an edge between any two objects which can be
void addNodeEdge(CycleNode *fromnode, CycleNode *tonode);
void putNode(const ModelAction *act, CycleNode *node);
CycleNode * getNode(const ModelAction *);
+ CycleNode * getNode(const Promise *promise);
+
HashTable<const CycleNode *, const CycleNode *, uintptr_t, 4, model_malloc, model_calloc, model_free> *discovered;
/** @brief A table for mapping ModelActions to CycleNodes */
HashTable<const ModelAction *, CycleNode *, uintptr_t, 4> actionToNode;
+ /** @brief A table for mapping reader ModelActions to Promise
+ * CycleNodes */
+ HashTable<const ModelAction *, CycleNode *, uintptr_t, 4> readerToPromiseNode;
+
#if SUPPORT_MOD_ORDER_DUMP
std::vector<CycleNode *> nodeList;
#endif