8 : rbt_([](const uint32_t &a, const uint32_t &b)
9 {
return static_cast<int>(a) -
static_cast<int>(b); })
25 node->
data_.event = event;
27 list->data_.Add(*node);
38 auto foreach_fun = [=](
Block &block)
40 block.cb.Run(
false, event);
54 auto foreach_fun = [=](
Block &block)
56 block.cb.Run(
true, event);
83 auto block =
new BindBlock{
this, target_event};
85 auto bind_fun = [](
bool in_isr, BindBlock *block, uint32_t event)
89 block->target->ActiveFromCallback(block->target->GetList(block->event), block->event);
提供一个通用的回调包装,支持动态参数传递。 Provides a generic callback wrapper, supporting dynamic argument passing.
static Callback Create(FunType fun, ArgType arg)
事件管理系统,允许基于事件 ID 注册和触发回调函数。 Event management system that allows registration and triggering of callba...
Event()
构造函数,初始化用于存储事件的红黑树。 Constructs an Event object with an empty red-black tree for event storage.
void Bind(Event &sources, uint32_t source_event, uint32_t target_event)
将源事件绑定到当前事件实例中的目标事件。 Binds an event from a source Event instance to a target event in the current ins...
void Active(uint32_t event)
触发与特定事件关联的所有回调函数(非中断上下文)。 Triggers all callbacks associated with a specific event (non-interrupt cont...
void Register(uint32_t event, const Callback &cb)
为特定事件注册回调函数。 Registers a callback function for a specific event.
void ActiveFromCallback(CallbackList list, uint32_t event)
从回调函数中触发与特定事件关联的所有回调函数。 Triggers all callbacks associated with a specific event (interrupt context).
CallbackList GetList(uint32_t event)
获取指定事件的回调链表指针(必须在非中断上下文中调用)。 Returns the callback list pointer for the given event (must be called ou...
数据节点模板,继承自 BaseNode,用于存储具体数据类型。 Template data node that inherits from BaseNode to store specific data...
Data data_
存储的数据。 The stored data.
链表实现,用于存储和管理数据节点。 A linked list implementation for storing and managing data nodes.
ErrorCode Foreach(Func func)
遍历链表中的每个节点,并应用回调函数。 Iterates over each node in the list and applies a callback function.
红黑树的泛型数据节点,继承自 BaseNode (Generic data node for Red-Black Tree, inheriting from BaseNode).
Node< Data > * Search(const Key &key)
搜索红黑树中的节点 (Search for a node in the Red-Black Tree).
void Insert(BaseNode &node, KeyType &&key)
在树中插入新节点 (Insert a new node into the tree).
用于存储事件回调的数据结构。 Data structure for storing event callbacks.