Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/36276 )

Change subject: sim: Implement optParamIn using paramIn.
......................................................................

sim: Implement optParamIn using paramIn.

This means only paramIn needs to be specialized, and then optParamIn
will be as well for free. It also removes some duplicate implementation.

Change-Id: Id124a05d04e1c0897121d0e13dd46efe90e8eed0
---
M src/sim/serialize.hh
1 file changed, 15 insertions(+), 18 deletions(-)



diff --git a/src/sim/serialize.hh b/src/sim/serialize.hh
index bbc91d7..c687542 100644
--- a/src/sim/serialize.hh
+++ b/src/sim/serialize.hh
@@ -472,24 +472,6 @@
 }

 /**
- * This function is used for restoring parameters from a checkpoint.
- * @param os The checkpoint to be restored from.
- * @param name Name of the parameter to be set.
- * @param param Value of the parameter to be restored.
- * @ingroup api_serialize
- */
-template <class T>
-void
-paramIn(CheckpointIn &cp, const std::string &name, T &param)
-{
-    const std::string &section(Serializable::currentSection());
-    std::string str;
-    if (!cp.find(section, name, str) || !parseParam(str, param)) {
-        fatal("Can't unserialize '%s:%s'\n", section, name);
-    }
-}
-
-/**
  * This function is used for restoring optional parameters from the
  * checkpoint.
  * @param cp The checkpoint to be written to.
@@ -519,6 +501,21 @@
 }

 /**
+ * This function is used for restoring parameters from a checkpoint.
+ * @param os The checkpoint to be restored from.
+ * @param name Name of the parameter to be set.
+ * @param param Value of the parameter to be restored.
+ * @ingroup api_serialize
+ */
+template <class T>
+void
+paramIn(CheckpointIn &cp, const std::string &name, T &param)
+{
+    fatal_if(!optParamIn(cp, name, param, false),
+        "Can't unserialize '%s:%s'", Serializable::currentSection(), name);
+}
+
+/**
  * @ingroup api_serialize
  */
 template <class T>

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/36276
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: Id124a05d04e1c0897121d0e13dd46efe90e8eed0
Gerrit-Change-Number: 36276
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to