GKD.RoboCtrl
RoboMaster Linux 电控:异步 IO、设备驱动与机器人控制
载入中...
搜索中...
未找到
roboctrl::io::keyed_io_base< TK > 模板类 参考

带 key 的 IO 基类,根据键值派发数据。 更多...

详细描述

template<typename TK>
class roboctrl::io::keyed_io_base< TK >

带 key 的 IO 基类,根据键值派发数据。

模板参数
TK键类型

在文件 base.hpp 第 154 行定义.

#include <base.hpp>

类 roboctrl::io::keyed_io_base< TK > 继承关系图:
roboctrl::io::keyed_io_base< TK > 的协作图:

Public 成员函数

void on_data (const TK &key, callback_fn< byte_span > auto fn, size_t size=0)
 注册指定 key 的回调。
 
template<detail::typed_callback_fn Fn>
requires (!std::same_as<std::remove_cvref_t<utils::function_arg_t<Fn>>,byte_span>)
void on_data (const TK &key, Fn &&fn)
 注册平凡类型包的回调。
 
- 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
 

Protected 成员函数

void dispatch (const TK &key, byte_span data)
 将数据派发给对应 key 的回调。
 
std::optional< size_t > package_size (const TK &key) const
 

构造及析构函数说明

◆ keyed_io_base()

template<typename TK >
roboctrl::io::keyed_io_base< TK >::keyed_io_base ( )
inline

在文件 base.hpp 第 159 行定义.

成员函数说明

◆ dispatch()

template<typename TK >
void roboctrl::io::keyed_io_base< TK >::dispatch ( const TK &  key,
byte_span  data 
)
inlineprotected

将数据派发给对应 key 的回调。

在文件 base.hpp 第 197 行定义.

引用了 roboctrl::io::make_shared_from().

◆ on_data() [1/2]

template<typename TK >
void roboctrl::io::keyed_io_base< TK >::on_data ( const TK &  key,
callback_fn< byte_span > auto  fn,
size_t  size = 0 
)
inline

注册指定 key 的回调。

在文件 base.hpp 第 164 行定义.

◆ on_data() [2/2]

template<typename TK >
template<detail::typed_callback_fn Fn>
requires (!std::same_as<std::remove_cvref_t<utils::function_arg_t<Fn>>,byte_span>)
void roboctrl::io::keyed_io_base< TK >::on_data ( const TK &  key,
Fn &&  fn 
)
inline

注册平凡类型包的回调。

在文件 base.hpp 第 184 行定义.

◆ package_size()

template<typename TK >
std::optional< size_t > roboctrl::io::keyed_io_base< TK >::package_size ( const TK &  key) const
inlineprotected

在文件 base.hpp 第 209 行定义.


该类的文档由以下文件生成: