Daniel Carvalho has submitted this change. ( 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>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27084
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Bobby R. Bruce <bbr...@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbr...@ucdavis.edu>
---
M src/base/statistics.hh
1 file changed, 8 insertions(+), 11 deletions(-)

Approvals:
  Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/base/statistics.hh b/src/base/statistics.hh
index 1c3d53d..b1f27c7 100644
--- a/src/base/statistics.hh
+++ b/src/base/statistics.hh
@@ -523,13 +523,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)
@@ -585,13 +578,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()); }
     void prepare() { data()->prepare(this->info()); }



4 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
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: 13
Gerrit-Owner: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Gem5 Cloud Project GCB service account <345032938...@cloudbuild.gserviceaccount.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to