action: add const qualifiers
authorBrian Norris <banorris@uci.edu>
Tue, 19 Jun 2012 23:00:57 +0000 (16:00 -0700)
committerBrian Norris <banorris@uci.edu>
Tue, 19 Jun 2012 23:02:59 +0000 (16:02 -0700)
action.cc
action.h

index dc980dbcdaaeb81c5e8a70939c1f4259ea48e3a7..34650c63927e03e471f9f17354fe39e786e46c77 100644 (file)
--- a/action.cc
+++ b/action.cc
@@ -26,22 +26,22 @@ ModelAction::~ModelAction()
                delete cv;
 }
 
-bool ModelAction::is_read()
+bool ModelAction::is_read() const
 {
        return type == ATOMIC_READ;
 }
 
-bool ModelAction::is_write()
+bool ModelAction::is_write() const
 {
        return type == ATOMIC_WRITE;
 }
 
-bool ModelAction::is_rmw()
+bool ModelAction::is_rmw() const
 {
        return type == ATOMIC_RMW;
 }
 
-bool ModelAction::is_acquire()
+bool ModelAction::is_acquire() const
 {
        switch (order) {
        case memory_order_acquire:
@@ -53,7 +53,7 @@ bool ModelAction::is_acquire()
        }
 }
 
-bool ModelAction::is_release()
+bool ModelAction::is_release() const
 {
        switch (order) {
        case memory_order_release:
@@ -65,17 +65,17 @@ bool ModelAction::is_release()
        }
 }
 
-bool ModelAction::is_seqcst()
+bool ModelAction::is_seqcst() const
 {
        return order==memory_order_seq_cst;
 }
 
-bool ModelAction::same_var(ModelAction *act)
+bool ModelAction::same_var(const ModelAction *act) const
 {
        return location == act->location;
 }
 
-bool ModelAction::same_thread(ModelAction *act)
+bool ModelAction::same_thread(const ModelAction *act) const
 {
        return tid == act->tid;
 }
@@ -90,7 +90,7 @@ bool ModelAction::same_thread(ModelAction *act)
  *  @return tells whether we have to explore a reordering.
  */
 
-bool ModelAction::is_synchronizing(ModelAction *act)
+bool ModelAction::is_synchronizing(const ModelAction *act) const
 {
        //Same thread can't be reordered
        if (same_thread(act))
index 976fd4881c8033c277d3d2b7d27b781a08b693a6..f6bc19b57827e8d0aa26c6fdaa9d0bf412c950c8 100644 (file)
--- a/action.h
+++ b/action.h
@@ -35,24 +35,24 @@ public:
        ~ModelAction();
        void print(void);
 
-       thread_id_t get_tid() { return tid; }
-       action_type get_type() { return type; }
-       memory_order get_mo() { return order; }
-       void * get_location() { return location; }
+       thread_id_t get_tid() const { return tid; }
+       action_type get_type() const { return type; }
+       memory_order get_mo() const { return order; }
+       void * get_location() const { return location; }
        int get_seq_number() const { return seq_number; }
 
-       Node * get_node() { return node; }
+       Node * get_node() const { return node; }
        void set_node(Node *n) { node = n; }
 
-       bool is_read();
-       bool is_write();
-       bool is_rmw();
-       bool is_acquire();
-       bool is_release();
-       bool is_seqcst();
-       bool same_var(ModelAction *act);
-       bool same_thread(ModelAction *act);
-       bool is_synchronizing(ModelAction *act);
+       bool is_read() const;
+       bool is_write() const;
+       bool is_rmw() const;
+       bool is_acquire() const;
+       bool is_release() const;
+       bool is_seqcst() const;
+       bool same_var(const ModelAction *act) const;
+       bool same_thread(const ModelAction *act) const;
+       bool is_synchronizing(const ModelAction *act) const;
 
        void create_cv(ModelAction *parent = NULL);
        void read_from(ModelAction *act);