287a288,310
> template <class T>
> bool
> parseParam(const std::string &s, BitUnionType<T> &value)
> {
> auto storage = static_cast<BitUnionBaseType<T>>(value);
> auto res = to_number(s, storage);
> value = storage;
> return res;
> }
>
> template <class T>
> void
> showParam(CheckpointOut &os, const BitUnionType<T> &value)
> {
> auto storage = static_cast<BitUnionBaseType<T>>(value);
>
> // For a BitUnion8, the storage type is an unsigned char.
> // Since we want to serialize a number we need to cast to
> // unsigned int
> os << ((sizeof(storage) == 1) ?
> static_cast<unsigned int>(storage) : storage);
> }
>
357,363d379
< template <typename T>
< void
< paramOut(CheckpointOut &cp, const std::string &name, const BitUnionType<T> &p)
< {
< paramOut(cp, name, static_cast<BitUnionBaseType<T> >(p));
< }
<
375,383d390
< template <typename T>
< void
< paramIn(CheckpointIn &cp, const std::string &name, BitUnionType<T> &p)
< {
< BitUnionBaseType<T> b;
< paramIn(cp, name, b);
< p = b;
< }
<
400,413d406
< template <typename T>
< bool
< optParamIn(CheckpointIn &cp, const std::string &name,
< BitUnionType<T> &p, bool warn = true)
< {
< BitUnionBaseType<T> b;
< if (optParamIn(cp, name, b, warn)) {
< p = b;
< return true;
< } else {
< return false;
< }
< }
<
631,655d623
< template <class T>
< static void
< arrayParamOut(CheckpointOut &cp, const std::string &name,
< const BitUnionType<T> *param, unsigned size)
< {
< // We copy the array into a vector. This is needed since we cannot
< // directly typecast a pointer to BitUnionType<T> into a pointer
< // of BitUnionBaseType<T> but we can typecast BitUnionType<T>
< // to BitUnionBaseType<T> since we overloaded the typecast operator
< std::vector<BitUnionBaseType<T>> bitunion_vec(param, param + size);
<
< arrayParamOut(cp, name, bitunion_vec);
< }
<
< template <class T>
< static void
< arrayParamIn(CheckpointIn &cp, const std::string &name,
< BitUnionType<T> *param, unsigned size)
< {
< std::vector<BitUnionBaseType<T>> bitunion_vec(size);
<
< arrayParamIn(cp, name, bitunion_vec);
< std::copy(bitunion_vec.begin(), bitunion_vec.end(), param);
< }
<