Wrapper for a raw byte buffer with methods to extract data from it.
More...
#include <packet_reader.hpp>
|
| std::span< char, N > | data () |
| | Provides direct access to the underlying buffer.
|
| |
| auto | get (Readable auto *...ps) |
| | Extracts typed data from the underlying raw byte buffer.
|
| |
| std::span< char, N > | data () |
| | Provides direct access to the underlying buffer.
|
| |
| auto | get (Readable auto *...ps) |
| | Extracts typed data from the underlying raw byte buffer.
|
| |
|
| static constexpr std::size_t | N = 32 |
| | Maximum buffer size.
|
| |
|
| template<typename T > |
| void | advance () |
| | Advances i after reading a type T.
|
| |
| template<typename T > |
| T | read () |
| | Reads a sngle value of type T from the buffer.
|
| |
| template<typename T > |
| ReadResult | read (T *p) |
| | Checks that the buffer contains a value of type T and reads it.
|
| |
| template<typename T > |
| void | advance () |
| | Advances i after reading a type T.
|
| |
| template<typename T > |
| T | read () |
| | Reads a sngle value of type T from the buffer.
|
| |
| template<typename T > |
| ReadResult | read (T *p) |
| | Checks that the buffer contains a value of type T and reads it.
|
| |
|
| std::array< char, N > | buf = {} |
| | Raw byte buffer.
|
| |
| size_t | i = {} |
| | Current offset into buf.
|
| |
Wrapper for a raw byte buffer with methods to extract data from it.
Values in the buffer are in the form:
size: uint8_t size uint8_t size
Type
Data types that can be read from a buffer.
Definition packet_reader.hpp:14
where size is sizeof(T) and T is such that type_to_enum<T> is the value in each preceding Type value in the buffer.
◆ advance() [1/2]
| void codex::Packet::advance |
( |
| ) |
|
|
private |
Advances i after reading a type T.
◆ advance() [2/2]
| void codex::Packet::advance |
( |
| ) |
|
|
private |
Advances i after reading a type T.
◆ data() [1/2]
| std::span< char, N > codex::Packet::data |
( |
| ) |
|
|
inline |
Provides direct access to the underlying buffer.
◆ data() [2/2]
| std::span< char, N > codex::Packet::data |
( |
| ) |
|
|
inline |
Provides direct access to the underlying buffer.
◆ get() [1/2]
| auto codex::Packet::get |
( |
Readable auto *... | ps | ) |
|
|
inline |
Extracts typed data from the underlying raw byte buffer.
◆ get() [2/2]
| auto codex::Packet::get |
( |
Readable auto *... | ps | ) |
|
|
inline |
Extracts typed data from the underlying raw byte buffer.
◆ read() [1/4]
| T codex::Packet::read |
( |
| ) |
|
|
private |
Reads a sngle value of type T from the buffer.
◆ read() [2/4]
| T codex::Packet::read |
( |
| ) |
|
|
private |
Reads a sngle value of type T from the buffer.
◆ read() [3/4]
Checks that the buffer contains a value of type T and reads it.
The current position in the buffer must contain a Type value t such that t == type_to_enum<T>.
◆ read() [4/4]
Checks that the buffer contains a value of type T and reads it.
The current position in the buffer must contain a Type value t such that t == type_to_enum<T>.
◆ buf
| std::array< char, N > codex::Packet::buf = {} |
|
private |
| size_t codex::Packet::i = {} |
|
private |
Current offset into buf.
Incremented after each get.
| static constexpr std::size_t codex::Packet::N = 32 |
|
staticconstexpr |
The documentation for this class was generated from the following files: