action: add is_atomic_var()
[model-checker.git] / action.cc
index 576f78a54bf6f27c79a89733de53e6a5d74c4990..a313b70fbe970810c96fe16bc1d7a0a27108508b 100644 (file)
--- a/action.cc
+++ b/action.cc
@@ -124,6 +124,12 @@ bool ModelAction::is_failed_trylock() const
        return (type == ATOMIC_TRYLOCK && value == VALUE_TRYFAILED);
 }
 
+/** @return True if this operation is performed on a C/C++ atomic variable */
+bool ModelAction::is_atomic_var() const
+{
+       return is_read() || could_be_write();
+}
+
 bool ModelAction::is_uninitialized() const
 {
        return type == ATOMIC_UNINIT;
@@ -346,6 +352,14 @@ void ModelAction::set_try_lock(bool obtainedlock) {
                value=VALUE_TRYFAILED;
 }
 
+/** @return The Node associated with this ModelAction */
+Node * ModelAction::get_node() const
+{
+       /* UNINIT actions do not have a Node */
+       ASSERT(!is_uninitialized());
+       return node;
+}
+
 /**
  * Update the model action's read_from action
  * @param act The action to read from; should be a write