31template <
class MantissaType,
class ExponentType>
class FixedPointDecimal;
32template <
class MantissaType,
class ExponentType>
class FloatingPointDecimal;
33template <
class Mantissa,
class Exponent> std::string
toStr(
const FixedPointDecimal<Mantissa, Exponent>&);
34template <
class Mantissa,
class Exponent> std::string
toStr(
const FloatingPointDecimal<Mantissa, Exponent>&);
37template <
class MantissaType,
class ExponentType>
40 MantissaType mantissa_;
41 ExponentType exponent_;
53 typedef MantissaType FirstArgType;
55 typedef ExponentType SecondArgType;
94 : mantissa_(other.mantissa_)
95 , exponent_(other.exponent_)
114 mantissa_ = other.mantissa_;
115 exponent_ = other.exponent_;
121 template <
class OtherMantissa,
class OtherExponent>
123 : mantissa_(other.mantissa())
124 , exponent_(other.exponent())
129 template <
class OtherMantissa,
class OtherExponent>
131 : mantissa_(other.mantissa())
132 , exponent_(other.exponent())
137 template <
class OtherMantissa,
class OtherExponent>
140 mantissa_ = other.mantissa();
141 exponent_ = other.exponent();
147 template <
class OtherMantissa,
class OtherExponent>
150 mantissa_ = other.mantissa();
151 exponent_ = other.exponent();
161 std::memcpy(addr, &mantissa_,
sizeof(mantissa_));
162 addr = advanceByBytes(addr,
sizeof(mantissa_));
164 std::memcpy(addr, &exponent_,
sizeof(exponent_));
169template <
class MantissaType,
class ExponentType>
173 MantissaType mantissa_;
185 typedef MantissaType FirstArgType;
222 : mantissa_(other.mantissa_)
241 mantissa_ = other.mantissa_;
251 std::memcpy(addr, &mantissa_,
sizeof(mantissa_));
#define ONIXS_CMEMDH_MESSAGING_NAMESPACE_BEGIN
#define ONIXS_CMEMDH_MESSAGING_NAMESPACE_END
#define ONIXS_CMEMDH_NODISCARD
ExponentType Exponent
Exponent component type.
std::string toString() const
constexpr FixedPointDecimal(const FixedPointDecimal &other) noexcept
Initializes the instance as a copy of the given one.
constexpr FixedPointDecimal(Mantissa mantissa) noexcept
Explicitly initializes the instance from the mantissa value.
Exponent exponent() const noexcept
FixedPointDecimal & operator=(const FixedPointDecimal &other) noexcept
Re-initializes the instance as a copy of the given one.
void serialize(void *addr) const noexcept
Serialize to the given data buffer.
MantissaType Mantissa
Mantissa component type.
constexpr FixedPointDecimal() noexcept
Default (zero) initialization.
Mantissa mantissa() const noexcept
ExponentType Exponent
Exponent component type.
std::string toString() const
FloatingPointDecimal & operator=(const FloatingPointDecimal &other) noexcept
Re-initializes the instance as copy of the given one.
constexpr FloatingPointDecimal() noexcept
Default (zero) initialization.
constexpr FloatingPointDecimal(Mantissa mantissa, Exponent exponent) noexcept
Explicitly initializes the instance from the mantissa and exponent values.
FloatingPointDecimal(const FixedPointDecimal< OtherMantissa, OtherExponent > &other) noexcept
Initializes the instance from the fixed point decimal.
FloatingPointDecimal & operator=(const FloatingPointDecimal< OtherMantissa, OtherExponent > &other) noexcept
Re-initializes instance as a copy of the floating point value.
constexpr FloatingPointDecimal(const FloatingPointDecimal &other) noexcept
Initializes the instance as a copy of the given one.
Exponent exponent() const noexcept
void serialize(void *addr) const noexcept
Serializes to the given data buffer.
MantissaType Mantissa
Mantissa component type.
FloatingPointDecimal & operator=(const FixedPointDecimal< OtherMantissa, OtherExponent > &other) noexcept
Re-initializes instance as a copy of the fixed point value.
Mantissa mantissa() const noexcept
FloatingPointDecimal(const FloatingPointDecimal< OtherMantissa, OtherExponent > &other) noexcept
Initializes the instance from the floating point decimal.
void toStr(std::string &, Int8)
Serializes given integer into a string.