#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
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__
#include <iterator>
#include <type_traits>
-#include "base/bitunion.hh"
#include "base/str.hh"
/**
}
};
-// 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:
}
};
-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__