libxr
Embedded C++ framework for bare-metal, RTOS and Linux
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
45 void Register(uint32_t event, const Callback& cb);
46
53 void Active(uint32_t event);
54
70 void ActiveFromCallback(CallbackList list, uint32_t event, bool in_isr = true);
71
86 CallbackList GetList(uint32_t event);
87
111 void Bind(Event& sources, uint32_t source_event, uint32_t target_event);
112
113 private:
119 struct Block
120 {
121 uint32_t event;
123 cb;
124 };
125
126 RBTree<uint32_t> rbt_;
128};
129
130} // namespace LibXR
事件管理系统,允许基于事件 ID 注册和触发回调函数。 Event management system that allows registration and triggering of callba...
Definition event.hpp:18
void ActiveFromCallback(CallbackList list, uint32_t event, bool in_isr=true)
从 callback-safe 路径触发与特定事件关联的所有回调函数。 Triggers all callbacks associated with a specific event from a ca...
Definition event.cpp:64
Event()
构造函数,初始化用于存储事件的红黑树。 Constructs an Event object with an empty red-black tree for event storage.
Definition event.cpp:25
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:92
void Active(uint32_t event)
触发与特定事件关联的所有回调函数(非中断上下文)。 Triggers all callbacks associated with a specific event (non-interrupt cont...
Definition event.cpp:47
void Register(uint32_t event, const Callback &cb)
为特定事件注册回调函数。 Registers a callback function for a specific event.
Definition event.cpp:30
CallbackList GetList(uint32_t event)
获取指定事件的回调链表指针(必须在非中断上下文中调用)。 Returns the callback list pointer for the given event (must be called ou...
Definition event.cpp:80
链表实现,用于存储和管理数据节点。 A linked list implementation for storing and managing data nodes.
红黑树实现,支持泛型键和值,并提供线程安全操作 Red-Black Tree implementation supporting generic keys and values with thread-...
Definition rbt.hpp:23
LibXR 命名空间 / LibXR namespace.
Definition ch32_can.hpp:14