X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=action.cc;h=893c812a1f39bd33f60a3b97291ffe9a525ae124;hb=8d4a273698366b54612e40742ef6fb7bd63c7090;hp=757b3d1d2fcc53bf1ed86a711785a84f808d1883;hpb=68b6b3ecad7edcaed6547d4d2be3eb974dfc98d6;p=model-checker.git diff --git a/action.cc b/action.cc index 757b3d1..893c812 100644 --- a/action.cc +++ b/action.cc @@ -613,3 +613,29 @@ unsigned int ModelAction::hash() const hash ^= reads_from->get_seq_number(); return hash; } + +/** + * @brief Checks the NodeStack to see if a ModelAction is in our may-read-from set + * @param write The ModelAction to check for + * @return True if the ModelAction is found; false otherwise + */ +bool ModelAction::may_read_from(const ModelAction *write) const +{ + for (int i = 0; i < node->get_read_from_past_size(); i++) + if (node->get_read_from_past(i) == write) + return true; + return false; +} + +/** + * @brief Checks the NodeStack to see if a Promise is in our may-read-from set + * @param promise The Promise to check for + * @return True if the Promise is found; false otherwise + */ +bool ModelAction::may_read_from(const Promise *promise) const +{ + for (int i = 0; i < node->get_read_from_promise_size(); i++) + if (node->get_read_from_promise(i) == promise) + return true; + return false; +}