|
GKD.RoboCtrl
|
异步任务上下文类。 更多...
#include <async.hpp>
类 | |
| struct | info_type |
Public 类型 | |
| using | task_type = awaitable<> |
Public 成员函数 | |
| void | spawn (task_type &&task) |
| 添加一个协程任务到上下文中执行。 | |
| template<typename Fn , typename... Args> | |
| void | post (Fn &&fn, Args &&... args) |
| 添加一个任务到上下文中执行。 | |
| void | run () |
| 开始运行任务上下文。 | |
| void | stop () |
| bool | init (info_type _info) |
| 初始化 task_context | |
| std::string | desc () const |
| task_context的描述 | |
| auto | get_executor () |
| 获取asio的executor。 | |
| auto | asio_context () -> asio::io_context & |
| 获取asio的io_context。 | |
Public 成员函数 继承自 roboctrl::utils::singleton_base< task_context > | |
| singleton_base (const singleton_base &)=delete | |
| singleton_base & | operator= (const singleton_base &)=delete |
Public 成员函数 继承自 roboctrl::utils::immovable_base | |
| immovable_base (immovable_base &&)=delete | |
| immovable_base & | operator= (immovable_base &&)=delete |
Public 成员函数 继承自 roboctrl::utils::not_copyable_base | |
| not_copyable_base (const not_copyable_base &)=delete | |
| not_copyable_base & | operator= (const not_copyable_base &)=delete |
额外继承的成员函数 | |
静态 Public 成员函数 继承自 roboctrl::utils::singleton_base< task_context > | |
| static task_context & | instance () |
| 获取单例实例 | |
Protected 成员函数 继承自 roboctrl::log::logable< task_context > | |
| void | log (log_level level, std::format_string< Args... > fmt, Args &&...args) const |
| 输出日志 | |
| void | log_debug (std::format_string< Args... > fmt, Args &&...args) const |
| 输出debug日志 | |
| void | log_info (std::format_string< Args... > fmt, Args &&...args) const |
| 输出info日志 | |
| void | log_warn (std::format_string< Args... > fmt, Args &&...args) const |
| 输出warn日志 | |
| void | log_error (std::format_string< Args... > fmt, Args &&...args) const |
| 输出error日志 | |
|
inline |
|
inline |
|
inline |
| bool task_context::init | ( | task_context::info_type | _info | ) |
初始化 task_context
添加一个任务到上下文中执行。
| Fn | 任务类型 |
| Args | 任务参数类型 |
| fn | 任务 |
| args | 任务参数 |
示例:
| void task_context::run | ( | ) |
| void task_context::spawn | ( | task_context::task_type && | task | ) |
添加一个协程任务到上下文中执行。
| task | 任务 |
示例: