void Node::print() const
{
action->print();
+ model_print(" thread status: ");
+ if (enabled_array) {
+ for (int i = 0; i < num_threads; i++) {
+ char str[20];
+ enabled_type_to_string(enabled_array[i], str);
+ model_print("[%d: %s]", i, str);
+ }
+ model_print("\n");
+ } else
+ model_print("(info not available)\n");
model_print(" backtrack: %s", backtrack_empty() ? "empty" : "non-empty ");
for (int i = 0; i < (int)backtrack.size(); i++)
if (backtrack[i] == true)
*/
Promise * Node::get_read_from_promise() const
{
- if (read_from_promise_idx < 0 || read_from_promise_idx >= ((int)read_from_promises.size()))
- return NULL;
+ ASSERT(read_from_promise_idx >= 0 && read_from_promise_idx < ((int)read_from_promises.size()));
return read_from_promises[read_from_promise_idx]->get_reads_from_promise();
}
+/**
+ * Gets a particular 'read-from-promise' form this Node. Only vlaid for a node
+ * where this->action is a 'read'.
+ * @param i The index of the Promise to get
+ * @return The Promise at index i, if the Promise is still available; NULL
+ * otherwise
+ */
+Promise * Node::get_read_from_promise(int i) const
+{
+ return read_from_promises[i]->get_reads_from_promise();
+}
+
+/** @return The size of the read-from-promise set */
+int Node::get_read_from_promise_size() const
+{
+ return read_from_promises.size();
+}
+
/**
* Checks whether the read_from_promises set for this node is empty.
* @return true if the read_from_promises set is empty.