libxr
Embedded C++ framework for bare-metal, RTOS and Linux
Loading...
Searching...
No Matches
LibXR::STDIO Class Reference

提供静态全局的输入输出接口绑定与写会话管理 / STDIO interface for read and write ports More...

#include <stdio.hpp>

Collaboration diagram for LibXR::STDIO:
[legend]

Static Public Member Functions

template<Print::Text Source, typename... Args>
static int Print (Args &&... args)
 将一个编译期 brace 字面量打印到当前 STDIO 输出 / Print one compile-time brace literal to the active STDIO output
 
template<Print::Text Source, typename... Args>
static int Printf (Args &&... args)
 将一个编译期 printf 字面量打印到当前 STDIO 输出 / Print one compile-time printf literal to the active STDIO output
 

Static Public Attributes

static ReadPort * read_ = nullptr
 读取端口 / Read port instance.
 
static WritePort * write_ = nullptr
 写入端口 / Write port instance.
 
static LibXR::Mutex * write_mutex_
 写入端口互斥锁 / Write port mutex.
 
static LibXR::WritePort::Stream * write_stream_
 可选的外部托管写流 / Optional externally owned write stream.
 

Detailed Description

提供静态全局的输入输出接口绑定与写会话管理 / STDIO interface for read and write ports

Definition at line 20 of file stdio.hpp.

Member Function Documentation

◆ Print()

template<Print::Text Source, typename... Args>
static int LibXR::STDIO::Print ( Args &&... args)
inlinestatic

将一个编译期 brace 字面量打印到当前 STDIO 输出 / Print one compile-time brace literal to the active STDIO output

Template Parameters
Source编译期 brace 格式字面量 / Compile-time brace format literal
Args调用点运行时参数类型列表 / Call-site runtime argument types
Parameters
args参与本次打印的运行时参数 / Runtime arguments used by the current print
Returns
返回当前 STDIO 流实际保留并提交的字节数;若会话建立或提交失败则返回 -1 / Returns the byte count actually retained and committed to the current STDIO stream; returns -1 on session or commit failure

Definition at line 227 of file stdio.hpp.

228 {
229 constexpr LibXR::Format<Source> format{};
230 return RunCompiled(format, std::forward<Args>(args)...);
231 }

◆ Printf()

template<Print::Text Source, typename... Args>
static int LibXR::STDIO::Printf ( Args &&... args)
inlinestatic

将一个编译期 printf 字面量打印到当前 STDIO 输出 / Print one compile-time printf literal to the active STDIO output

Template Parameters
Source编译期 printf 格式字面量 / Compile-time printf format literal
Args调用点运行时参数类型列表 / Call-site runtime argument types
Parameters
args参与本次打印的运行时参数 / Runtime arguments used by the current print
Returns
返回当前 STDIO 流实际保留并提交的字节数;若会话建立或提交失败则返回 -1 / Returns the byte count actually retained and committed to the current STDIO stream; returns -1 on session or commit failure

Definition at line 244 of file stdio.hpp.

245 {
246 constexpr auto format = Print::Printf::Build<Source>();
247 return RunCompiled(format, std::forward<Args>(args)...);
248 }
static consteval Compiled< Source > Build()
在编译期解析并校验 printf 格式串 / Parse and validate a printf format at compile time
Definition printf.hpp:124

Member Data Documentation

◆ read_

ReadPort* LibXR::STDIO::read_ = nullptr
inlinestatic

读取端口 / Read port instance.

Definition at line 25 of file stdio.hpp.

◆ write_

WritePort* LibXR::STDIO::write_ = nullptr
inlinestatic

写入端口 / Write port instance.

Definition at line 26 of file stdio.hpp.

◆ write_mutex_

LibXR::Mutex* LibXR::STDIO::write_mutex_
inlinestatic
Initial value:
=
nullptr

写入端口互斥锁 / Write port mutex.

Definition at line 27 of file stdio.hpp.

◆ write_stream_

LibXR::WritePort::Stream* LibXR::STDIO::write_stream_
inlinestatic
Initial value:
=
nullptr

可选的外部托管写流 / Optional externally owned write stream.

Definition at line 29 of file stdio.hpp.


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