|
VLink
2.3.0
A high-performance communication middleware
|
Bounds-checked SOME/IP payload reader. 更多...
#include <someip_serializer.h>
Public 成员函数 | |
| Reader (const uint8_t *data, size_t size, size_t alignment=1U, Endian endian=Endian::kBig) noexcept | |
Creates a reader over an immutable size-byte payload. 更多... | |
| size_t | position () const noexcept |
| Returns the current read position. 更多... | |
| size_t | size () const noexcept |
| Returns the total payload size. 更多... | |
| const uint8_t * | current_data () const noexcept |
Returns the current byte pointer, or nullptr at the end. 更多... | |
| bool | read (uint8_t *data, size_t size, size_t end) noexcept |
Reads size bytes without exceeding end. 更多... | |
| bool | skip (size_t size, size_t end) noexcept |
Advances by size bytes without exceeding end. 更多... | |
| bool | read_unsigned (uint64_t &value, size_t width, size_t end) noexcept |
Reads a width-byte unsigned integer in the configured byte order. 更多... | |
| bool | read_unsigned (uint64_t &value, size_t width, Endian endian, size_t end) noexcept |
Reads a width-byte unsigned integer in an explicit byte order. 更多... | |
| bool | begin_length_delimited (size_t end, size_t &value_end, size_t width=sizeof(uint32_t)) noexcept |
| Reads a length field and returns its validated end position. 更多... | |
| bool | align (size_t end) noexcept |
| Skips bytes up to the configured AUTOSAR alignment. 更多... | |
Bounds-checked SOME/IP payload reader.
Every operation accepts an enclosing end position, so nested arrays cannot consume bytes belonging to their parent structure. Successful operations advance the cursor. The cursor state after a failed compound field is not specified; a top-level failure may leave already decoded destination fields updated.
|
noexcept |
Creates a reader over an immutable size-byte payload.
The reader does not own the source storage. When size is non-zero, data must remain valid throughout the reader lifetime.
| data | Source payload. |
| size | Total source size in bytes. |
| alignment | AUTOSAR payload alignment: 1, 2, 4, 8, 16, or 32 bytes. |
| endian | Byte order for payload scalar values. |
|
noexcept |
Skips bytes up to the configured AUTOSAR alignment.
| end | Exclusive enclosing boundary. |
true on success; false when the padding exceeds end.
|
noexcept |
Reads a length field and returns its validated end position.
The prefix is a big-endian byte count. On success, value_end is the exclusive end of the declared body and the reader points to its first byte.
| end | Exclusive enclosing boundary. |
| value_end | Output exclusive boundary of the length-delimited body. |
| width | Encoded width in bytes; must be 1, 2, or 4. |
true on success; false when the prefix or declared body exceeds end.
|
noexcept |
Returns the current byte pointer, or nullptr at the end.
position(), or nullptr when no bytes remain.
|
noexcept |
Returns the current read position.
|
noexcept |
Reads size bytes without exceeding end.
The destination range must not overlap the source range read by this operation.
| data | Destination buffer; must hold size bytes when non-zero. |
| size | Number of bytes to copy. |
| end | Exclusive enclosing boundary, not greater than size(). |
true on success; false when the requested range is invalid.
|
noexcept |
Reads a width-byte unsigned integer in an explicit byte order.
Wire-format metadata such as TLV tags and union type selectors keeps network byte order independently of the configured payload byte order.
| value | Output value; modified only after the range is validated. |
| width | Encoded width in bytes; must be in the range [1,8]. |
| endian | Byte order for this value only. |
| end | Exclusive enclosing boundary, not greater than size(). |
true on success; false for an invalid width or range.
|
noexcept |
Reads a width-byte unsigned integer in the configured byte order.
| value | Output value; modified only after the range is validated. |
| width | Encoded width in bytes; must be in the range [1,8]. |
| end | Exclusive enclosing boundary, not greater than size(). |
true on success; false for an invalid width or range.
|
noexcept |
Returns the total payload size.
|
noexcept |
Advances by size bytes without exceeding end.
| size | Number of bytes to skip. |
| end | Exclusive enclosing boundary, not greater than size(). |
true on success; false when the requested range is invalid.