ngl_server 1.0
基于 Actor 模型的 C++ 服务器框架
ngl::nbt_coro_action_node< TACTOR > Class Template Referencefinal

协程动作节点包装类。 More...

#include <nbt.h>

Inheritance diagram for ngl::nbt_coro_action_node< TACTOR >:

Public Member Functions

 nbt_coro_action_node (const std::string &aname, const BT::NodeConfig &aconfig, nbt_node_callback< TACTOR > afun)
 构造函数。
nbt_status tick () override
 执行协程tick。

Detailed Description

template<typename TACTOR>
class ngl::nbt_coro_action_node< TACTOR >

协程动作节点包装类。

继承自BT::CoroActionNode,允许回调在执行过程中通过 setStatusRunningAndYield()暂停并返回RUNNING给父节点。 下次tick时协程从暂停处恢复执行。

Template Parameters
TACTORActor类型
Note
适用于需要分步执行或等待外部事件的动作。

Constructor & Destructor Documentation

◆ nbt_coro_action_node()

template<typename TACTOR>
ngl::nbt_coro_action_node< TACTOR >::nbt_coro_action_node ( const std::string & aname,
const BT::NodeConfig & aconfig,
nbt_node_callback< TACTOR > afun )
inline

构造函数。

Parameters
aname节点实例名称
aconfig节点配置
afun协程回调函数

Member Function Documentation

◆ tick()

template<typename TACTOR>
nbt_status ngl::nbt_coro_action_node< TACTOR >::tick ( )
inlineoverride

执行协程tick。

调用回调函数,支持协程暂停和恢复。

Returns
节点状态(SUCCESS/FAILURE/RUNNING)

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