class BinaryReader

Defined at line 30 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

Light-weight class for decoding structs in a safe manner.

Each operation returns a pointer to a valid struct or nullptr indicating

that the read would return an invalid structure, such as a structure out of

bounds of the original input buffer.

BinaryReader supports a common requirement in ACPI of variable-length

structures, where a struct consists of a header followed by a payload.

To support such structures, we require a |size| method returning the

size of the header + payload.

Successful reads consume bytes from the buffer, while failed reads don't

modify internal state.

Public Methods

void BinaryReader ()

Defined at line 32 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

void BinaryReader (std::span<const uint8_t> data)

Construct a BinaryReader from the given span.

Defined at line 35 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

void BinaryReader (std::span<const uint8_t> data)

Construct a BinaryReader from the given span.

Defined at line 35 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

void BinaryReader (std::span<const uint8_t> data)

Construct a BinaryReader from the given span.

Defined at line 35 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

void BinaryReader (std::span<const uint8_t> data)

Construct a BinaryReader from the given span.

Defined at line 35 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

void BinaryReader (const void * data, size_t size)

Construct a BinaryReader from the given pointer / size pair.

Defined at line 38 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

void BinaryReader (const void * data, size_t size)

Construct a BinaryReader from the given pointer / size pair.

Defined at line 38 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

void BinaryReader (const void * data, size_t size)

Construct a BinaryReader from the given pointer / size pair.

Defined at line 38 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

template <typename T>
BinaryReader FromVariableSizedStruct (const T * header)

Construct a BinaryReader from a valid structure with a size() method.

Defined at line 43 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

template <typename T>
BinaryReader FromPayloadOfStruct (const T * header)

Construct a BinaryReader from a class with a size() method, skipping the header T.

Defined at line 49 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

template <typename T>
const T * ReadFixedLength ()

Read a fixed-length structure.

Defined at line 57 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

template <typename T>
const T * Read ()

Read a variable length structure, where the size is determined by T::size().

Defined at line 73 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

bool SkipBytes (size_t bytes)

Discard the given number of bytes.

Return true if the bytes could be discarded, or false if there are insufficient bytes.

Defined at line 99 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

bool SkipBytes (size_t bytes)

Discard the given number of bytes.

Return true if the bytes could be discarded, or false if there are insufficient bytes.

Defined at line 99 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

bool SkipBytes (size_t bytes)

Discard the given number of bytes.

Return true if the bytes could be discarded, or false if there are insufficient bytes.

Defined at line 99 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h

bool empty ()

Return true if all the bytes of the reader have been consumed.

Defined at line 108 of file ../../zircon/kernel/lib/acpi_lite/binary_reader.h