Struct FieldDecodeInfo

Struct Documentation

struct FieldDecodeInfo

Helper struct to load/store bit sequences from packets.

NOTE: getters and setters require up to 64 bits of valid memory past the bit we are attempting to set/retrieve, so caution is advised.

Public Functions

template<typename T>
inline T get(const uint8_t *buffer) const

Retrieves the value from the buffer.

NOTE: the check that T is of at least the size of ChanFieldType used is deferred because this function is used in the hot loop

Parameters:

buffer[in] buffer to retrieve the value from.

Returns:

value

template<typename T>
inline void set(uint8_t *buffer, T value) const

Stores the value into the buffer.

NOTE: the check that T is of at least the size of ChanFieldType used is deferred because this function is used in the hot loop

Parameters:
  • buffer[in] buffer to retrieve the value from.

  • value[in] value to store

Public Members

ChanFieldType ty_tag

Type tag for the field, used to determine how to interpret the bits.

size_t offset

Offset in bytes from the start of the buffer.

uint64_t mask

Bitmask for the field.

int shift

Bit shift for the field.

int num_elements = 1

Number of elements with this type tag decoded.