libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
Writer::ArgumentReader Class Reference

运行期参数字节块的顺序读取器 / Sequential reader for the packed runtime argument byte blob More...

#include <writer_reader.hpp>

Public Member Functions

 ArgumentReader (const uint8_t *data)
 从单个运行期参数打包字节块构造读取器 / Create a reader over one packed runtime argument blob
 
template<typename T >
Read ()
 以无对齐要求的方式读取一个已打包参数值 / Read one packed argument value without requiring alignment
 

Private Attributes

const uint8_t * pos_ = nullptr
 

Detailed Description

运行期参数字节块的顺序读取器 / Sequential reader for the packed runtime argument byte blob

Definition at line 99 of file writer_reader.hpp.

Constructor & Destructor Documentation

◆ ArgumentReader()

Writer::ArgumentReader::ArgumentReader ( const uint8_t * data)
inlineexplicit

从单个运行期参数打包字节块构造读取器 / Create a reader over one packed runtime argument blob

Parameters
data指向运行期参数打包字节块的指针 / Pointer to the packed runtime argument blob

Definition at line 106 of file writer_reader.hpp.

106: pos_(data) {}

Member Function Documentation

◆ Read()

template<typename T >
T Writer::ArgumentReader::Read ( )
inlinenodiscard

以无对齐要求的方式读取一个已打包参数值 / Read one packed argument value without requiring alignment

Template Parameters
T待读取的已打包参数类型 / Packed argument type to read
Returns
返回解码后的已打包参数值 / Returns the decoded packed argument value

Definition at line 114 of file writer_reader.hpp.

115 {
116 T value{};
117 std::memcpy(&value, pos_, sizeof(T));
118 pos_ += sizeof(T);
119 return value;
120 }

Field Documentation

◆ pos_

const uint8_t* Writer::ArgumentReader::pos_ = nullptr
private

Definition at line 123 of file writer_reader.hpp.


The documentation for this class was generated from the following file: