|
libxr
1.0
Want to be the best embedded framework
|
按输出端共享重后端、按调用点 profile 裁剪操作码分发的字节码执行器 / Per-sink bytecode executor with shared heavy backends and per-call profile-pruned opcode dispatch More...
#include <writer_executor.hpp>
Public Member Functions | |
| Executor (Sink &sink, const uint8_t *codes, const uint8_t *args) | |
| 将一个输出端、一份编译字节块和一份参数字节块绑定起来 / Bind one sink with one compiled byte blob and one packed argument blob | |
| template<FormatProfile Profile> | |
| ErrorCode | Run () |
持续执行记录流,直到遇到 FormatOp::End / Run until the compiled record stream reaches FormatOp::End | |
Private Member Functions | |
| ErrorCode | WriteRaw (std::string_view text) |
| 运行期执行器共享的字段写出原语,供所有操作码路径复用 / Executor-side field-writing primitives shared by all runtime opcodes | |
| ErrorCode | WritePadding (char fill, size_t count) |
| 向输出端写入重复填充字符 / Write repeated fill characters into the sink | |
| ErrorCode | WriteTextField (std::string_view text, const Spec &spec) |
| 按宽度与对齐策略写出一个文本字段 / Write one text field with width/alignment policy applied | |
| ErrorCode | WriteIntegerField (char sign_char, std::string_view prefix, std::string_view digits, const Spec &spec) |
| 按符号、前缀、精度与填充策略写出一个整数载荷 / Write one integer payload with sign, prefix, precision, and padding policy applied | |
| ErrorCode | WriteFloatField (char sign_char, std::string_view text, const Spec &spec) |
| 按符号与字段填充策略写出一个浮点文本载荷 / Write one float text payload with sign and field padding applied | |
| template<std::signed_integral Int> | |
| ErrorCode | WriteSigned (const Spec &spec, Int value) |
| 通过共享整数字段路径写出一个有符号整数值 / Write one signed integer value through the shared integer-field path | |
| template<FormatType Type, std::unsigned_integral UInt> | |
| ErrorCode | DispatchUnsigned (const Spec &spec, UInt value) |
| 通过共享整数字段路径写出一个无符号整数语义值 / Write one unsigned integer semantic value through the shared integer-field path | |
| template<uint8_t Base, bool UpperCase = false, bool PrependOctalZero = false, std::unsigned_integral UInt> | |
| ErrorCode | WriteUnsignedDigits (std::string_view prefix, const Spec &spec, UInt value) |
| 按编译期进制/大小写/八进制备用格式参数复用无符号数字载荷写出逻辑 / Reuse the unsigned-digit payload writer with compile-time radix, case, and octal-alternate parameters | |
| ErrorCode | WritePointer (const Spec &spec, uintptr_t value) |
| 按规范指针字段策略写出一个指针值 / Write one pointer value using the canonical pointer field policy | |
| ErrorCode | WriteCharacter (const Spec &spec, char ch) |
| 写出一个字符字段值 / Write one character field value | |
| ErrorCode | WriteString (const Spec &spec, std::string_view text) |
| 写出一个字符串字段值,并在需要时应用精度截断 / Write one string field value, including precision truncation when present | |
| ErrorCode | WriteU32Dec (uint32_t value) |
| 单个原始 uint32_t 十进制字段的快路径。 / Fast path for one raw uint32_t decimal field. | |
| ErrorCode | WriteI32Dec (int32_t value) |
| 单个原始 int32_t 十进制字段的快路径。 / Fast path for one raw int32_t decimal field. | |
| template<uint8_t Base, bool UpperCase = false> | |
| ErrorCode | WriteU32Base (uint32_t value) |
| 单个原始 uint32_t 非十进制字段的快路径。 / Fast path for one raw uint32_t non-decimal field. | |
| ErrorCode | WriteU32ZeroPadWidth (uint8_t width, uint32_t value) |
| 单个零填充 uint32_t 十进制字段的快路径。 / Fast path for one zero-padded uint32_t decimal field. | |
| ErrorCode | WriteStringRaw (std::string_view text) |
| 单个原始字符串参数的快路径。 / Fast path for one raw string argument. | |
| ErrorCode | WriteCharacterRaw (char ch) |
| 单个原始字符参数的快路径。 / Fast path for one raw character argument. | |
| template<std::signed_integral Int> | |
| ErrorCode | DispatchSignedField () |
运行期执行器中 GenericField 的分发桥接函数 / GenericField dispatch bridges for the runtime executor | |
| template<FormatType Type, std::unsigned_integral UInt> | |
| ErrorCode | DispatchUnsignedField () |
| 读取一个无符号载荷并转发给选定的整数语义写出路径 / Read one unsigned payload and forward it to the selected integer semantic writer | |
| ErrorCode | DispatchPointerField () |
| 读取一个指针载荷并走指针字段写出路径 / Read one pointer payload and write it through the pointer field path | |
| ErrorCode | DispatchCharacterField () |
| 读取一个字符载荷并走字符字段写出路径 / Read one character payload and write it through the character field path | |
| ErrorCode | DispatchStringField () |
| 读取一个字符串载荷并走字符串字段写出路径 / Read one string payload and write it through the string field path | |
| template<FormatProfile Profile> | |
| ErrorCode | DispatchGenericField (FormatType type) |
将一个 GenericField 载荷分发到对应的宽回退路径 / Dispatch one GenericField payload to the corresponding wide fallback | |
| template<FormatProfile Profile> | |
| ErrorCode | DispatchOp (FormatOp op) |
| 将一个运行期操作码分发到选中的特化路径 / Dispatch one runtime opcode to the selected specialized path | |
Static Private Member Functions | |
| template<std::signed_integral Int> | |
| static char | ResolveSignChar (Int value, const Spec &spec) |
| 执行器的具体运行期数值写出函数 / Concrete runtime value writers for the executor | |
Private Attributes | |
| Sink & | sink_ |
| CodeReader | codes_ |
| ArgumentReader | args_ |
按输出端共享重后端、按调用点 profile 裁剪操作码分发的字节码执行器 / Per-sink bytecode executor with shared heavy backends and per-call profile-pruned opcode dispatch
| Sink | 输出端类型,需满足 OutputSink / Sink type satisfying OutputSink |
Definition at line 10 of file writer_executor.hpp.
| Writer::Executor< Sink >::Executor | ( | Sink & | sink, |
| const uint8_t * | codes, | ||
| const uint8_t * | args ) |
将一个输出端、一份编译字节块和一份参数字节块绑定起来 / Bind one sink with one compiled byte blob and one packed argument blob
writer 执行器的顶层运行期操作码循环。 / Top-level runtime opcode loop for the writer executor.
| sink | 输出端 / Destination sink |
| codes | 指向编译字节块的指针 / Pointer to the compiled byte blob |
| args | 指向运行期参数打包字节块的指针;无参数时可为空 / Pointer to the packed runtime argument blob, or null when no arguments exist |
将一个输出端、码流和参数字节块绑定到当前执行器 / Bind one sink, code stream, and packed-argument blob to this executor
| sink | 输出端 / Destination sink |
| codes | 指向编译字节流的指针 / Pointer to the compiled byte stream |
| args | 指向已打包参数字节块的指针;无参数时可为空 / Pointer to the packed argument blob, or null when no arguments exist |
Definition at line 17 of file writer_executor_opcode.hpp.
|
nodiscardprivate |
读取一个字符载荷并走字符字段写出路径 / Read one character payload and write it through the character field path
Definition at line 69 of file writer_executor_generic.hpp.
|
nodiscardprivate |
将一个 GenericField 载荷分发到对应的宽回退路径 / Dispatch one GenericField payload to the corresponding wide fallback
将一个 GenericField 语义类型分发到具体宽回退写出路径 / Dispatch one GenericField semantic type to the concrete wide fallback writer
| Profile | 当前编译格式使用的精确通用字段类型集合 / Exact generic-field type set used by the current compiled format |
| type | GenericField 记录携带的语义字段类型 / Semantic field type carried by the GenericField record |
| type | 当前 GenericField 携带的运行期语义类型 / Runtime semantic type carried by this GenericField |
Definition at line 94 of file writer_executor_generic.hpp.
|
nodiscardprivate |
将一个运行期操作码分发到选中的特化路径 / Dispatch one runtime opcode to the selected specialized path
将一个顶层操作码分发到其特化运行期路径 / Dispatches one top-level opcode to its specialized runtime path.
| Profile | 当前编译格式需要的操作码配置 / Opcode profile required by the current compiled format |
| op | 解码后的运行期操作码 / Decoded runtime opcode |
| Profile | 当前编译格式需要的操作码配置 / Opcode profile required by the current compiled format |
| op | Decoded runtime opcode. / 解码后的运行期操作码。 |
Definition at line 62 of file writer_executor_opcode.hpp.
|
nodiscardprivate |
读取一个指针载荷并走指针字段写出路径 / Read one pointer payload and write it through the pointer field path
Definition at line 58 of file writer_executor_generic.hpp.
|
nodiscardprivate |
运行期执行器中 GenericField 的分发桥接函数 / GenericField dispatch bridges for the runtime executor
读取一个有符号载荷并转发给具体有符号写出路径 / Read one signed payload and forward it to the concrete signed writer
| Int | 有符号打包存储类型 / Signed packed-storage type |
Definition at line 16 of file writer_executor_generic.hpp.
|
nodiscardprivate |
读取一个字符串载荷并走字符串字段写出路径 / Read one string payload and write it through the string field path
Definition at line 80 of file writer_executor_generic.hpp.
|
nodiscardprivate |
通过共享整数字段路径写出一个无符号整数语义值 / Write one unsigned integer semantic value through the shared integer-field path
| Type | 运行期整数语义类型 / Runtime integer semantic type |
| UInt | 无符号整数类型 / Unsigned integer type |
| spec | 解码后的字段规格 / Decoded field spec |
| value | 待写出的整数值 / Integer value to write |
This bridge does not format digits itself; it only maps one runtime integer semantic type onto the shared compile-time radix/case helper above. 这个桥接函数本身不直接格式化数字;它只负责把运行期整数语义类型映射到上面的 编译期进制/大小写共享辅助路径。
Definition at line 150 of file writer_executor_value.hpp.
|
nodiscardprivate |
读取一个无符号载荷并转发给选定的整数语义写出路径 / Read one unsigned payload and forward it to the selected integer semantic writer
| Type | 运行期整数语义类型 / Runtime integer semantic type |
| UInt | 无符号打包存储类型 / Unsigned packed-storage type |
Definition at line 31 of file writer_executor_generic.hpp.
|
staticnodiscardprivate |
执行器的具体运行期数值写出函数 / Concrete runtime value writers for the executor
为一个有符号整数载荷确定最终可见的符号字符 / Resolve the visible sign character for one signed integer payload
| Int | 有符号整数类型 / Signed integer type |
| value | 当前要输出的整数值 / Integer value being emitted |
| spec | 解码后的字段规格 / Decoded field spec |
、'+'、' '或'\0'/ Returns'-','+',' ', or'\0'` Definition at line 17 of file writer_executor_value.hpp.
|
nodiscard |
持续执行记录流,直到遇到 FormatOp::End / Run until the compiled record stream reaches FormatOp::End
运行操作码循环,直到遇到 End 或首个 sink/运行期错误 / Runs the opcode loop until End or the first sink/runtime error.
| Profile | 当前编译格式需要的操作码配置 / Opcode profile required by the current compiled format |
ErrorCode::OK / Returns the first sink or runtime error, or ErrorCode::OK when the record stream finishes normally| Profile | 当前编译格式需要的操作码配置 / Opcode profile required by the current compiled format |
ErrorCode::OK on normal completion, or the first sink / runtime error. / 正常结束返回 ErrorCode::OK;否则返回首个 sink/运行期错误。 Definition at line 33 of file writer_executor_opcode.hpp.
|
nodiscardprivate |
写出一个字符字段值 / Write one character field value
| spec | 解码后的字段规格 / Decoded field spec |
| ch | 待写出的字符值 / Character value to write |
Definition at line 208 of file writer_executor_value.hpp.
|
nodiscardprivate |
单个原始字符参数的快路径。 / Fast path for one raw character argument.
写出一个原始字符快路径字段 / Writes one raw character fast-path field.
| ch | Character payload to write. / 待写出的字符载荷。 |
Definition at line 393 of file writer_executor_value.hpp.
|
nodiscardprivate |
按符号与字段填充策略写出一个浮点文本载荷 / Write one float text payload with sign and field padding applied
| sign_char | 最终可见的符号字符;无符号时为 ‘’\0'/ Visible sign character, or '\0'when absent @param text 已完成格式化的浮点文本载荷 / Already formatted float text payload @param spec 解码后的字段规格 / Decoded field spec @return 返回首个 sink 错误;成功时返回ErrorCode::OK/ Returns the first sink error, orErrorCode::OK` on success |
Definition at line 184 of file writer_executor_field.hpp.
|
nodiscardprivate |
单个原始 int32_t 十进制字段的快路径。 / Fast path for one raw int32_t decimal field.
写出一个原始 int32 十进制快路径字段 / Writes one raw int32 decimal fast-path field.
| value | Signed value to write. / 待写出的有符号值。 |
Definition at line 320 of file writer_executor_value.hpp.
|
nodiscardprivate |
按符号、前缀、精度与填充策略写出一个整数载荷 / Write one integer payload with sign, prefix, precision, and padding policy applied
| sign_char | 最终可见的符号字符;无符号时为 ‘’\0'/ Visible sign character, or '\0'when absent @param prefix 输出在数字前面的前缀 / Prefix emitted ahead of the digits @param digits 十进制、二进制、八进制或十六进制数字载荷 / Decimal, binary, octal, or hex digit payload @param spec 解码后的字段规格 / Decoded field spec @return 返回首个 sink 错误;成功时返回ErrorCode::OK/ Returns the first sink error, orErrorCode::OK` on success |
Definition at line 98 of file writer_executor_field.hpp.
|
nodiscardprivate |
向输出端写入重复填充字符 / Write repeated fill characters into the sink
| fill | 填充字符 / Fill character |
| count | 重复次数 / Repeat count |
ErrorCode::OK / Returns the first sink error, or ErrorCode::OK when all fill bytes are written Definition at line 27 of file writer_executor_field.hpp.
|
nodiscardprivate |
按规范指针字段策略写出一个指针值 / Write one pointer value using the canonical pointer field policy
| spec | 解码后的字段规格 / Decoded field spec |
| value | 以 uintptr_t 编码的指针值 / Pointer value encoded as uintptr_t |
Definition at line 186 of file writer_executor_value.hpp.
|
nodiscardprivate |
运行期执行器共享的字段写出原语,供所有操作码路径复用 / Executor-side field-writing primitives shared by all runtime opcodes
将一段原始文本直接写入输出端 / Write one raw text chunk directly into the sink
| text | Text chunk to write. / 待写出的文本片段。 |
Definition at line 14 of file writer_executor_field.hpp.
|
nodiscardprivate |
通过共享整数字段路径写出一个有符号整数值 / Write one signed integer value through the shared integer-field path
| Int | 有符号整数类型 / Signed integer type |
| spec | 解码后的字段规格 / Decoded field spec |
| value | 待写出的整数值 / Integer value to write |
Definition at line 81 of file writer_executor_value.hpp.
|
nodiscardprivate |
写出一个字符串字段值,并在需要时应用精度截断 / Write one string field value, including precision truncation when present
| spec | 解码后的字段规格 / Decoded field spec |
| text | 待写出的字符串载荷 / String payload to write |
Definition at line 221 of file writer_executor_value.hpp.
|
nodiscardprivate |
单个原始字符串参数的快路径。 / Fast path for one raw string argument.
写出一个原始字符串快路径字段 / Writes one raw string fast-path field.
| text | String payload to write. / 待写出的字符串载荷。 |
Definition at line 382 of file writer_executor_value.hpp.
|
nodiscardprivate |
按宽度与对齐策略写出一个文本字段 / Write one text field with width/alignment policy applied
| text | 上层归一化后的文本载荷 / Text payload after higher-level normalization |
| spec | 解码后的字段规格 / Decoded field spec |
ErrorCode::OK / Returns the first sink error, or ErrorCode::OK on success Definition at line 55 of file writer_executor_field.hpp.
|
nodiscardprivate |
单个原始 uint32_t 非十进制字段的快路径。 / Fast path for one raw uint32_t non-decimal field.
写出一个原始 uint32 多进制快路径字段 / Writes one raw uint32 base-specific fast-path field.
| Base | Integer radix. / 整数进制。 |
| UpperCase | Whether hexadecimal digits are uppercase. / 十六进制数字是否大写。 |
| value | Unsigned value to write. / 待写出的无符号值。 |
Definition at line 349 of file writer_executor_value.hpp.
|
nodiscardprivate |
单个原始 uint32_t 十进制字段的快路径。 / Fast path for one raw uint32_t decimal field.
通过共享浮点文本后端写出一个浮点语义值 / Write one float semantic value through the shared float-text backend
| T | 浮点类型 / Float type |
| type | 运行期浮点语义类型 / Runtime float semantic type |
| spec | 解码后的字段规格 / Decoded field spec |
| value | 待写出的浮点值 / Float value to write |
写出一个原始 uint32 十进制快路径字段 / Writes one raw uint32 decimal fast-path field.
| value | Unsigned value to write. / 待写出的无符号值。 |
Definition at line 306 of file writer_executor_value.hpp.
|
nodiscardprivate |
单个零填充 uint32_t 十进制字段的快路径。 / Fast path for one zero-padded uint32_t decimal field.
写出一个带零填充宽度的 uint32_t 十进制快路径字段 / Write one zero-padded uint32_t decimal fast-path field
| width | 目标零填充宽度 / Target zero-padded width |
| value | 待写出的无符号值 / Unsigned value to write |
Definition at line 364 of file writer_executor_value.hpp.
|
nodiscardprivate |
按编译期进制/大小写/八进制备用格式参数复用无符号数字载荷写出逻辑 / Reuse the unsigned-digit payload writer with compile-time radix, case, and octal-alternate parameters
通过共享整数字段路径写出一个无符号整数语义值 / Write one unsigned integer semantic value through the shared integer-field path
| Base | 整数进制 / Integer radix |
| UpperCase | 十六进制数字是否使用大写字符 / Whether hexadecimal digits should use uppercase characters |
| PrependOctalZero | 是否把 %#o 的前导 0 直接并入数字载荷 / Whether %#o should inline its leading 0 into the digit payload |
| UInt | 无符号整数类型 / Unsigned integer type |
| prefix | 脱离数字载荷输出的前缀 / Prefix emitted outside the digit payload |
| spec | 解码后的字段规格 / Decoded field spec |
| value | 待写出的整数值 / Integer value to write |
| Base | 整数进制 / Integer radix |
| UpperCase | 十六进制数字是否使用大写字符 / Whether hexadecimal digits should use uppercase characters |
| PrependOctalZero | 是否把 %#o 的前导 0 直接并入数字载荷 / Whether %#o should inline its leading 0 into the digit payload |
| UInt | 无符号整数类型 / Unsigned integer type |
| prefix | 脱离数字载荷输出的前缀 / Prefix emitted outside the digit payload |
| spec | 解码后的字段规格 / Decoded field spec |
| value | 待写出的整数值 / Integer value to write |
Definition at line 115 of file writer_executor_value.hpp.
|
private |
Definition at line 172 of file writer_executor.hpp.
|
private |
Definition at line 171 of file writer_executor.hpp.
|
private |
Definition at line 170 of file writer_executor.hpp.