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

线程化动作节点包装类。 More...

#include <nbt.h>

Inheritance diagram for ngl::nbt_threaded_action_node< TACTOR >:

Public Member Functions

 nbt_threaded_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_threaded_action_node< TACTOR >

线程化动作节点包装类。

继承自BT::ThreadedAction,在独立线程上运行tick()。 回调函数必须定期检查节点的isHaltRequested(),收到中止请求时及时返回。

Template Parameters
TACTORActor类型
Note
适用于阻塞I/O或CPU密集型操作,避免阻塞行为树主线程。
Warning
回调函数中需要定期检查isHaltRequested()以支持优雅停止。

Constructor & Destructor Documentation

◆ nbt_threaded_action_node()

template<typename TACTOR>
ngl::nbt_threaded_action_node< TACTOR >::nbt_threaded_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_threaded_action_node< TACTOR >::tick ( )
inlineoverride

执行线程化tick。

在独立线程中调用回调函数。

Returns
节点状态

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