Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/36283 )
Change subject: base,sim: Move BitUnion serialization support to
bitunion.hh.
......................................................................
base,sim: Move BitUnion serialization support to bitunion.hh.
This keeps the BitUnion code centralized and out of the generic
serialization code.
Change-Id: I297638df4f8908096b7c439298fbaf03236f9011
---
M src/base/bitunion.hh
M src/sim/serialize_handlers.hh
2 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/src/base/bitunion.hh b/src/base/bitunion.hh
index bf183ae..aef6f6e 100644
--- a/src/base/bitunion.hh
+++ b/src/base/bitunion.hh
@@ -35,6 +35,7 @@
#include <typeinfo>
#include "base/bitfield.hh"
+#include "sim/serialize_handlers.hh"
// The following implements the BitUnion system of defining bitfields
//on top of an underlying class. This is done through the pervasive use of
@@ -505,4 +506,30 @@
os, (BitUnionBaseType<T>)bu);
}
+// Specialization for BitUnion types.
+template <class T>
+struct ParseParam<BitUnionType<T>>
+{
+ static bool
+ parse(const std::string &s, BitUnionType<T> &value)
+ {
+ // Zero initialize storage to avoid leaking an uninitialized value
+ BitUnionBaseType<T> storage = BitUnionBaseType<T>();
+ auto res = to_number(s, storage);
+ value = storage;
+ return res;
+ }
+};
+
+template <class T>
+struct ShowParam<BitUnionType<T>>
+{
+ static void
+ show(std::ostream &os, const BitUnionType<T> &value)
+ {
+ ShowParam<BitUnionBaseType<T>>::show(
+ os, static_cast<const BitUnionBaseType<T> &>(value));
+ }
+};
+
#endif // __BASE_BITUNION_HH__
diff --git a/src/sim/serialize_handlers.hh b/src/sim/serialize_handlers.hh
index 506ecf5..2f22282 100644
--- a/src/sim/serialize_handlers.hh
+++ b/src/sim/serialize_handlers.hh
@@ -50,7 +50,6 @@
#include <iterator>
#include <type_traits>
-#include "base/bitunion.hh"
#include "base/str.hh"
/**
@@ -103,21 +102,6 @@
}
};
-// Specialization for BitUnion types.
-template <class T>
-struct ParseParam<BitUnionType<T>>
-{
- static bool
- parse(const std::string &s, BitUnionType<T> &value)
- {
- // Zero initialize storage to avoid leaking an uninitialized value
- BitUnionBaseType<T> storage = BitUnionBaseType<T>();
- auto res = to_number(s, storage);
- value = storage;
- return res;
- }
-};
-
/*
* A structure which should be specialized to contain a static method with
the
* signature:
@@ -163,17 +147,6 @@
}
};
-template <class T>
-struct ShowParam<BitUnionType<T>>
-{
- static void
- show(std::ostream &os, const BitUnionType<T> &value)
- {
- ShowParam<BitUnionBaseType<T>>::show(
- os, static_cast<const BitUnionBaseType<T> &>(value));
- }
-};
-
/** @} */
#endif // __SERIALIZE_HANDLERS_HH__
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/36283
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: I297638df4f8908096b7c439298fbaf03236f9011
Gerrit-Change-Number: 36283
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