libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
event.hpp
1#pragma once
2
3#include "libxr_cb.hpp"
4#include "libxr_def.hpp"
5#include "lockfree_list.hpp"
6#include "rbt.hpp"
7
8namespace LibXR
9{
10
17class Event
18{
19 public:
21
28
33 Event();
34
42 void Register(uint32_t event, const Callback &cb);
43
50 void Active(uint32_t event);
51
61 void ActiveFromCallback(CallbackList list, uint32_t event);
62
71 CallbackList GetList(uint32_t event);
72
81 void Bind(Event &sources, uint32_t source_event, uint32_t target_event);
82
83 private:
89 struct Block
90 {
91 uint32_t event;
94 };
95
98};
99
100} // namespace LibXR
事件管理系统,允许基于事件 ID 注册和触发回调函数。 Event management system that allows registration and triggering of callba...
Definition event.hpp:18
RBTree< uint32_t > rbt_
Definition event.hpp:96
Event()
构造函数,初始化用于存储事件的红黑树。 Constructs an Event object with an empty red-black tree for event storage.
Definition event.cpp:7
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...
Definition event.cpp:75
void Active(uint32_t event)
触发与特定事件关联的所有回调函数(非中断上下文)。 Triggers all callbacks associated with a specific event (non-interrupt cont...
Definition event.cpp:30
void Register(uint32_t event, const Callback &cb)
为特定事件注册回调函数。 Registers a callback function for a specific event.
Definition event.cpp:13
void ActiveFromCallback(CallbackList list, uint32_t event)
从回调函数中触发与特定事件关联的所有回调函数。 Triggers all callbacks associated with a specific event (interrupt context).
Definition event.cpp:47
CallbackList GetList(uint32_t event)
获取指定事件的回调链表指针(必须在非中断上下文中调用)。 Returns the callback list pointer for the given event (must be called ou...
Definition event.cpp:63
链表实现,用于存储和管理数据节点。 A linked list implementation for storing and managing data nodes.
红黑树实现,支持泛型键和值,并提供线程安全操作 (Red-Black Tree implementation supporting generic keys and values with thread...
Definition rbt.hpp:24
LibXR 命名空间
Definition ch32_gpio.hpp:9
用于存储事件回调的数据结构。 Data structure for storing event callbacks.
Definition event.hpp:90
Callback cb
关联该事件的回调函数。 Callback function associated with this event.
Definition event.hpp:93
uint32_t event
与该回调关联的事件 ID。 Event ID associated with this callback.
Definition event.hpp:91