![]() |
RMVL
2.5.0-dev
Robotic Manipulation and Vision Library
|
轻量级发布订阅服务异步节点 更多...
#include <rmvl/lpss/node.hpp>
Public 成员函数 | |
| Node (std::string_view name, uint8_t domain_id=0) | |
| 创建通用节点,默认域 ID 为 0 | |
| ~Node () noexcept | |
| Guid | guid () const noexcept |
| 获取节点唯一标识符 | |
| template<typename MsgType, typename = std::enable_if_t<is_msg_v<MsgType>>> | |
| Publisher< MsgType >::ptr | createPublisher (std::string_view topic) noexcept |
| 创建发布者 | |
| template<typename MsgType, typename SubscribeMsgCallback, typename = std::enable_if_t<is_msg_v<MsgType> && std::is_invocable_v<SubscribeMsgCallback, const MsgType &>>> | |
| Subscriber< MsgType >::ptr | createSubscriber (std::string_view topic, SubscribeMsgCallback callback) noexcept |
| 创建订阅者 | |
| template<typename SrvType, typename ServiceCallback, typename = std::enable_if_t<is_srv_v<SrvType> && std::is_invocable_r_v<void, ServiceCallback, const typename SrvType::Request &, typename SrvType::Response &>>> | |
| Service< SrvType >::ptr | createService (std::string_view service, ServiceCallback callback) noexcept |
| 创建异步服务端 | |
| template<typename SrvType, typename = std::enable_if_t<is_srv_v<SrvType>>> | |
| Client< SrvType >::ptr | createClient (std::string_view service) noexcept |
| 创建异步客户端 | |
| template<typename MsgType> | |
| void | destroyPublisher (std::shared_ptr< Publisher< MsgType > > pub) |
| 销毁发布者 | |
| template<typename MsgType> | |
| void | destroySubscriber (std::shared_ptr< Subscriber< MsgType > > sub) |
| 销毁订阅者 | |
| template<typename Rep, typename Period, typename TimerCallback> | |
| Timer::ptr | createTimer (std::chrono::duration< Rep, Period > dur, TimerCallback callback) noexcept |
| 创建异步定时器 | |
| void | spin () |
| 运行异步 IO 上下文 | |
| template<typename Callable, typename... Args> | |
| void | create_task (Callable &&fn, Args &&...args) |
| 生成异步任务,并添加到当前节点的调度器 | |
| void | shutdown () noexcept |
| 手动停止节点运行 | |
Protected 属性 | |
| rm::async::IOContext | _ctx {} |
| 异步 IO 上下文 | |
| std::unordered_map< Guid, NodeStorageInfo, GuidHash > | _discovered_nodes {} |
| 已发现的节点列表 | |
| std::unordered_map< std::string, DataWriterBase::ptr > | _local_writers {} |
| 已注册的 Writers 列表 | |
| std::unordered_map< std::string, DataReaderBase::ptr > | _local_readers {} |
| 已注册的 Readers 列表 | |
| std::unordered_map< std::string, DiscoveredWriterStorageInfo > | _discovered_writers {} |
| 已发现的 Writers 列表 | |
| std::unordered_map< std::string, DiscoveredReaderStorageInfo > | _discovered_readers {} |
| 已发现的 Readers 列表 | |
轻量级发布订阅服务异步节点
|
explicit |
创建通用节点,默认域 ID 为 0
| [in] | name | 节点名称 |
| [in] | domain_id | 域 ID |
|
inlinenoexcept |
|
inline |
生成异步任务,并添加到当前节点的调度器
| [in] | fn | 协程函数 |
| [in] | args | 协程函数参数 |
|
noexcept |
创建异步客户端
| SrvType | 服务类型 |
| [in] | service | 服务名称 |
|
noexcept |
创建发布者
| MsgType | 消息类型 |
| [in] | topic | 话题名称 |
|
noexcept |
|
noexcept |
创建订阅者
| MsgType | 消息类型 |
| SubscribeMsgCallback | 订阅回调函数类型 |
| [in] | topic | 话题名称 |
| [in] | callback | 订阅回调函数 |
|
noexcept |
创建异步定时器
| Rep | 定时器时间间隔的表示类型 |
| Period | 定时器时间间隔的周期类型 |
| TimerCallback | 定时器回调函数类型 |
| [in] | dur | 定时器时间间隔 |
| [in] | callback | 定时器回调函数 |
| void rm::lpss::async::Node::destroyPublisher | ( | std::shared_ptr< Publisher< MsgType > > | pub | ) |
销毁发布者
| MsgType | 消息类型 |
| [in] | pub | 发布者对象 |
| void rm::lpss::async::Node::destroySubscriber | ( | std::shared_ptr< Subscriber< MsgType > > | sub | ) |
销毁订阅者
| MsgType | 消息类型 |
| [in] | sub | 订阅者对象 |
|
inlinenoexcept |
获取节点唯一标识符
|
noexcept |
手动停止节点运行
|
inline |
运行异步 IO 上下文
|
protected |
异步 IO 上下文
|
protected |
已发现的节点列表
|
protected |
已发现的 Readers 列表
|
protected |
已发现的 Writers 列表
|
protected |
已注册的 Readers 列表
|
protected |
已注册的 Writers 列表