LDMX Software
Packing
include
Packing
Utility
Hex.h
1
#ifndef PACKING_UTILITY_HEX_H_
2
#define PACKING_UTILITY_HEX_H_
3
4
#include <iomanip>
5
6
namespace
packing {
7
namespace
utility {
8
17
template
<
typename
WordType>
18
struct
hex
{
19
static
const
std::size_t width_{8 *
sizeof
(WordType)};
20
WordType& word_;
21
hex
(WordType& w) : word_{w} {}
22
friend
inline
std::ostream& operator<<(
23
std::ostream& os,
const
packing::utility::hex<WordType>
& h) {
24
os <<
"0x"
<< std::setfill(
'0'
) << std::setw(h.width_) << std::hex
25
<< h.word_ << std::dec;
26
return
os;
27
}
28
};
29
30
}
// namespace utility
31
}
// namespace packing
32
33
#endif
// PACKING_UTILITY_HEX_H_
packing::utility::hex
A very simple wrapper enabling us to more easily tell the output stream to style the input word in he...
Definition
Hex.h:18
Generated by
1.9.8