From 5f5f526a141aa4727cb37920212623c8afffa1f6 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 1 Mar 2013 19:06:30 -0800 Subject: [PATCH] nodestack: add support functions for check_recency() w/ Promises --- nodestack.cc | 18 ++++++++++++++++++ nodestack.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/nodestack.cc b/nodestack.cc index 515a2d3..0127347 100644 --- a/nodestack.cc +++ b/nodestack.cc @@ -462,6 +462,24 @@ Promise * Node::get_read_from_promise() const 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. diff --git a/nodestack.h b/nodestack.h index f478db2..3cffac9 100644 --- a/nodestack.h +++ b/nodestack.h @@ -76,6 +76,8 @@ public: void add_read_from_promise(const ModelAction *reader); Promise * get_read_from_promise() const; + Promise * get_read_from_promise(int i) const; + int get_read_from_promise_size() const; bool add_future_value(struct future_value fv); struct future_value get_future_value() const; -- 2.34.1