6 #ifndef KAGOME_TRANSACRIPT_HPP 7 #define KAGOME_TRANSACRIPT_HPP 21 inline void decompose(
const T &value, uint8_t (&dst)[
sizeof(value)]) {
22 static_assert(std::is_pod_v<T>,
"T must be pod!");
23 static_assert(!std::is_reference_v<T>,
"T must not be a reference!");
25 for (
size_t i = 0; i <
sizeof(value); ++i) {
26 #if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ 27 dst[
sizeof(value) - i - 1] =
31 static_cast<uint8_t>((value >> (8 * i)) & 0xff);
44 template <
typename T,
size_t N>
47 (uint8_t[11]){
'M',
'e',
'r',
'l',
'i',
'n',
' ',
'v',
'1',
'.',
'0'});
48 append_message((uint8_t[]){
'd',
'o',
'm',
'-',
's',
'e',
'p'}, label);
51 template <
typename T,
size_t N,
typename K,
size_t M>
53 const uint32_t data_len =
sizeof(msg);
54 strobe_.
metaAd<
false>(label);
56 uint8_t tmp[
sizeof(data_len)];
60 strobe_.
ad<
false>(msg);
63 template <
typename T,
size_t N>
65 uint8_t tmp[
sizeof(value)];
71 return strobe_.
data();
75 return strobe_.
data();
85 #endif // KAGOME_TRANSACRIPT_HPP void metaAd(const T(&label)[N])
bool operator==(const Transcript &other) const
void initialize(const T(&label)[N])
void initialize(const T(&label)[N])
Transcript & operator=(const Transcript &)=default
void append_message(const T(&label)[N], const K(&msg)[M])
void ad(const T(&src)[N])
void append_message(const T(&label)[N], const uint64_t value)
void decompose(const T &value, uint8_t(&dst)[sizeof(value)])