16 #ifndef LARDATA_RECOBASEART_DUMPERS_HEXFLOAT_H 17 #define LARDATA_RECOBASEART_DUMPERS_HEXFLOAT_H 1 22 #include <type_traits> 36 static_assert(!std::is_same<std::decay_t<T>,
float>::
value,
37 "OptionalHexFloatFormatter does not support float values");
43 template <
typename Stream>
51 template <
typename Stream>
61 template <
typename Stream>
64 constexpr
auto buf_size = 8 *
sizeof(
real_t) + 1;
66 std::snprintf(buf, buf_size,
"%+24.14a", v);
71 template <
typename Stream>
84 std::ostream& operator<<(std::ostream& os, details::OptionalHexFloatFormatter<T> fmt)
125 template <
typename T>
132 template <
typename T>
139 template <
typename T>
148 #endif // LARDATA_RECOBASEART_DUMPERS_HEXFLOAT_H
auto operator()(bool this_active, T value) const
Returns an object that knows what to do with an output stream.
OptionalHexFloat(bool start_active=true)
Constructor: if start_active is true, it will print floats in base 16.
void disable()
Disables base 16 printing.
auto operator()(T value) const
Returns an object that knows what to do with an output stream.
Helper for formatting floats in base 16.
void enable(bool enable=true)
Enables base 16 printing (or disables it if enable is false)
bool active
whether we are writing in base 16
LArSoft-specific namespace.
bool enabled() const
Returns whether base 16 printing is enabled.