NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
载入中...
搜索中...
未找到
neforce::signal< Types > 模板结构体 参考

信号类 更多...

#include <signals.hpp>

类 neforce::signal< Types > 继承关系图:
[图例]

Public 成员函数

template<typename Self, typename MemFn, typename... Tag>
connection connect (Self self, MemFn memfn, Tag... tag)
 连接成员函数(默认优先级0)
template<typename Func>
connection connect (Func callback, int priority=0)
 连接普通函数/lambda
template<typename Self, typename MemFn, typename... Tag>
connection connect (Self self, MemFn memfn, int priority, Tag... tag)
 连接成员函数
void emit (Types... args)
 触发信号
template<typename Executor>
void emit_executor (Executor &executor, Types... args)
 执行器触发信号
template<typename... Args>
void operator() (Args &&... args)
 函数调用操作符
void disconnect_all () override
 断开所有连接
connection connect_signal (signal &other, int priority=0)
 连接另一个信号
connection connect_signal (signal *other, int priority=0)
 连接另一个信号(指针版本)
template<typename Func, typename Predicate>
connection connect_if (Func callback, Predicate pred, int priority=0)
 条件连接
template<typename Self, typename MemFn, typename Predicate, typename... Tag>
connection connect_if (Self self, MemFn memfn, Predicate pred, int priority, Tag... tag)
 条件连接(成员函数版本)
template<typename Func, typename Filter>
connection connect_filtered (Func callback, Filter filter, int priority=0)
 过滤连接
template<typename Func, typename Transform>
connection connect_transformed (Func callback, Transform transform, int priority=0)
 变换连接
shared_ptr< bool > block_flag () const noexcept
 获取阻塞标志
bool is_blocked () const noexcept override
 检查信号是否被阻塞
void block () override
 阻塞信号触发
void unblock () override
 解除阻塞
size_t slot_count () const noexcept override
 获取活跃槽的数量
void connect_dynamic (function< void(const vector< reflect::meta_any > &)> callback) override
 动态连接(类型擦除版本)
void emit_dynamic (const vector< reflect::meta_any > &args) override
 通过 meta_any 触发信号(类型擦除版本)
bool empty () const noexcept
 检查信号是否为空(无活跃槽)

详细描述

template<typename... Types>
struct neforce::signal< Types >

信号类

模板参数
Types信号参数类型列表

多播委托实现。

在文件 signals.hpp296 行定义.

成员函数说明

◆ block_flag()

template<typename... Types>
shared_ptr< bool > neforce::signal< Types >::block_flag ( ) const
inlinenoexcept

获取阻塞标志

返回
阻塞标志的共享指针

在文件 signals.hpp765 行定义.

◆ connect() [1/3]

template<typename... Types>
template<typename Func>
connection neforce::signal< Types >::connect ( Func callback,
int priority = 0 )
inline

连接普通函数/lambda

模板参数
Func函数类型
参数
callback回调函数
priority优先级(值越大优先级越高)
返回
连接句柄

在文件 signals.hpp506 行定义.

◆ connect() [2/3]

template<typename... Types>
template<typename Self, typename MemFn, typename... Tag>
connection neforce::signal< Types >::connect ( Self self,
MemFn memfn,
int priority,
Tag... tag )
inline

连接成员函数

模板参数
Self对象类型
MemFn成员函数类型
Tag连接标签类型
参数
self对象指针/智能指针
memfn成员函数指针
priority优先级
tag连接标签(可选)
返回
连接句柄

在文件 signals.hpp524 行定义.

◆ connect() [3/3]

template<typename... Types>
template<typename Self, typename MemFn, typename... Tag>
connection neforce::signal< Types >::connect ( Self self,
MemFn memfn,
Tag... tag )
inline

连接成员函数(默认优先级0)

模板参数
Self对象类型
MemFn成员函数类型
Tag连接标签类型
参数
self对象指针/智能指针
memfn成员函数指针
tag连接标签(可选)
返回
连接句柄

在文件 signals.hpp494 行定义.

◆ connect_dynamic()

template<typename... Types>
void neforce::signal< Types >::connect_dynamic ( function< void(const vector< reflect::meta_any > &)> callback)
inlineoverridevirtual

动态连接(类型擦除版本)

参数
callback接收 meta_any 参数列表的回调

将类型擦除的回调适配为信号的实际参数类型并连接。

实现了 neforce::signal_base.

在文件 signals.hpp805 行定义.

◆ connect_filtered()

template<typename... Types>
template<typename Func, typename Filter>
connection neforce::signal< Types >::connect_filtered ( Func callback,
Filter filter,
int priority = 0 )
inline

过滤连接

模板参数
Func回调函数类型
Filter过滤器类型,返回值必须为 optional
参数
callback回调函数
filter过滤器
priority优先级
返回
连接句柄

过滤器可以修改或抑制参数。

在文件 signals.hpp721 行定义.

◆ connect_if() [1/2]

template<typename... Types>
template<typename Func, typename Predicate>
connection neforce::signal< Types >::connect_if ( Func callback,
Predicate pred,
int priority = 0 )
inline

条件连接

模板参数
Func回调函数类型
Predicate谓词类型
参数
callback回调函数
pred谓词
priority优先级
返回
连接句柄

仅当谓词返回true时才调用回调。

在文件 signals.hpp664 行定义.

◆ connect_if() [2/2]

template<typename... Types>
template<typename Self, typename MemFn, typename Predicate, typename... Tag>
connection neforce::signal< Types >::connect_if ( Self self,
MemFn memfn,
Predicate pred,
int priority,
Tag... tag )
inline

条件连接(成员函数版本)

模板参数
Self对象类型
MemFn成员函数类型
Predicate谓词类型
Tag连接标签类型
参数
self对象指针/智能指针
memfn成员函数指针
pred谓词
priority优先级
tag连接标签
返回
连接句柄

在文件 signals.hpp692 行定义.

◆ connect_signal() [1/2]

template<typename... Types>
connection neforce::signal< Types >::connect_signal ( signal< Types > & other,
int priority = 0 )
inline

连接另一个信号

参数
other另一个信号
priority优先级
返回
连接句柄

当此信号触发时,会转发给other信号。

在文件 signals.hpp624 行定义.

◆ connect_signal() [2/2]

template<typename... Types>
connection neforce::signal< Types >::connect_signal ( signal< Types > * other,
int priority = 0 )
inline

连接另一个信号(指针版本)

参数
other另一个信号指针
priority优先级
返回
连接句柄

当此信号触发时,如果指针非空,则转发给other信号。

在文件 signals.hpp641 行定义.

◆ connect_transformed()

template<typename... Types>
template<typename Func, typename Transform>
connection neforce::signal< Types >::connect_transformed ( Func callback,
Transform transform,
int priority = 0 )
inline

变换连接

模板参数
Func回调函数类型
Transform变换函数类型
参数
callback回调函数
transform变换函数
priority优先级
返回
连接句柄

变换函数将参数转换为新类型后传递给回调。

在文件 signals.hpp750 行定义.

◆ emit()

template<typename... Types>
void neforce::signal< Types >::emit ( Types... args)
inline

触发信号

参数
args信号参数

同步调用所有已连接的槽函数。会自动清理已断开或请求擦除的槽。 如果信号被阻塞,则什么也不做。

在文件 signals.hpp547 行定义.

◆ emit_dynamic()

template<typename... Types>
void neforce::signal< Types >::emit_dynamic ( const vector< reflect::meta_any > & args)
inlineoverridevirtual

通过 meta_any 触发信号(类型擦除版本)

参数
args参数列表

实现了 neforce::signal_base.

在文件 signals.hpp819 行定义.

◆ emit_executor()

template<typename... Types>
template<typename Executor>
void neforce::signal< Types >::emit_executor ( Executor & executor,
Types... args )
inline

执行器触发信号

模板参数
Executor执行器类型
参数
executor执行器对象
args信号参数

在指定的执行器上异步调用emit。

在文件 signals.hpp586 行定义.

◆ empty()

template<typename... Types>
bool neforce::signal< Types >::empty ( ) const
inlinenodiscardnoexcept

检查信号是否为空(无活跃槽)

返回
是否为空

在文件 signals.hpp830 行定义.

◆ is_blocked()

template<typename... Types>
bool neforce::signal< Types >::is_blocked ( ) const
inlineoverridevirtualnoexcept

检查信号是否被阻塞

返回
是否被阻塞

实现了 neforce::signal_base.

在文件 signals.hpp771 行定义.

◆ operator()()

template<typename... Types>
template<typename... Args>
void neforce::signal< Types >::operator() ( Args &&... args)
inline

函数调用操作符

参数
args信号参数

在文件 signals.hpp605 行定义.

◆ slot_count()

template<typename... Types>
size_t neforce::signal< Types >::slot_count ( ) const
inlineoverridevirtualnoexcept

获取活跃槽的数量

返回
槽数量

实现了 neforce::signal_base.

在文件 signals.hpp795 行定义.


该结构体的文档由以下文件生成: