Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/27084 )

Change subject: base: Make read-only functions const in ScalarBase
......................................................................

base: Make read-only functions const in ScalarBase

These functions do not need to modify their storage's contents.

ScalarBase's non-const value() has been removed.

Change-Id: I4dd3899a29a741a7d8cd199ccd254b346d86ae07
Signed-off-by: Daniel R. Carvalho <oda...@yahoo.com.br>
---
M src/base/statistics.hh
1 file changed, 8 insertions(+), 11 deletions(-)



diff --git a/src/base/statistics.hh b/src/base/statistics.hh
index 2447615..c3f7ebc 100644
--- a/src/base/statistics.hh
+++ b/src/base/statistics.hh
@@ -525,13 +525,6 @@
     }

   public:
-    /**
-     * Return the current value of this stat as its base type.
-     * @return The current value.
-     */
-    Counter value() const { return data()->value(); }
-
-  public:
     ScalarBase(Group *parent = nullptr, const char *name = nullptr,
                const char *desc = nullptr)
         : DataWrap<Derived, ScalarInfoProxy>(parent, name, desc)
@@ -587,13 +580,17 @@
      */
     size_type size() const { return 1; }

-    Counter value() { return data()->value(); }
+    /**
+     * Return the current value of this stat as its base type.
+     * @return The current value.
+     */
+    Counter value() const { return data()->value(); }

-    Result result() { return data()->result(); }
+    Result result() const { return data()->result(); }

-    Result total() { return result(); }
+    Result total() const { return result(); }

-    bool zero() { return result() == 0.0; }
+    bool zero() const { return result() == 0.0; }

     void reset() { data()->reset(this->info()->storageParams); }
     void prepare() { data()->prepare(this->info()->storageParams); }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/27084
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I4dd3899a29a741a7d8cd199ccd254b346d86ae07
Gerrit-Change-Number: 27084
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to