EVENGINE_API_FOUNDATION public API. 更多...
#include <PlatformEvent.h>
Public 成员函数 | |
| Module_REG (PlatformEvent) | |
| virtual | ~PlatformEvent () |
| Platform event. | |
| void | push (Message *msg) |
| Queues a message. Thread-safe: workers may push completions for the main loop to poll. | |
| void | push (std::unique_ptr< Message > msg) |
| Queues an owning message handle; ownership transfers to the queue. | |
| void | pushData (std::string name, std::string data="") |
| Script helper: pushes an event with an optional string payload. | |
| Message * | poll () |
| Pops the oldest message, or nullptr if the queue is empty. @ownership Ownership transfers to the caller, which must delete the message. @lifetime Valid until caller deletion; independent of subsequent queue mutation. @thread Thread-safe queue operation; observer callbacks run after unlocking. @reentrancy Poll observers may re-enter the queue. | |
| std::unique_ptr< Message > | pollOwned () |
| Pops the oldest message into an RAII handle, or returns null. | |
| std::string | pollName () |
| Script helper: pops one message and returns its name, or "" if none. | |
| std::string | getLastData () const |
| First string arg of the message most recently returned by pollName/pollData. | |
| std::string | pollData () |
| Pops one message and returns its first string arg (or ""). Name is discarded — use pollName when you need the type. | |
| virtual void | clear () |
| Drops all queued messages and frees them. | |
| void | setPollObserver (std::function< void(const Message &)> observer) |
| Sets an observer invoked for every message consumed via poll*(). | |
| const std::function< void(const Message &)> & | pollObserver () const |
| Current poll observer, or empty if none. | |
| eve::Subscription | subscribePoll (std::function< void(const Message &)> callback) |
| Subscribe to every message consumed by poll/pollOwned. | |
| std::uint64_t | pollObserverFailureCount () const noexcept |
| Number of contained poll-listener exceptions since construction. | |
| virtual void | pump ()=0 |
| Platform hook: pumps the native event queue into this module. | |
| virtual Message * | wait ()=0 |
| Platform hook: blocks until a message is available, then polls it. @ownership Ownership transfers to the caller, which must delete the message. @lifetime Valid until caller deletion and independent of the platform queue. @thread Call on the platform event thread. @reentrancy Does not invoke script while blocked. | |
| std::unique_ptr< Message > | waitOwned () |
| Blocking wait returning an RAII handle. | |
Public 成员函数 继承自 eve::Module | |
| virtual | ~Module () |
| Module. | |
| virtual std::string | getName () const =0 |
| Returns the name. | |
Protected 成员函数 | |
| virtual void | wakeWaiters () |
| Wake a platform-specific blocking wait after a message is queued. | |
Protected 属性 | |
| std::mutex | queueMu_ |
| std::queue< std::unique_ptr< Message > > | queue |
| std::string | lastData_ |
| std::function< void(const Message &)> | pollObserver_ |
| Void. | |
| eve::Observer< Message > | pollObservers_ |
| eve::Subscription | legacyPollSubscription_ |
| std::uint64_t | pollObserverFailures_ = 0 |
详细描述
EVENGINE_API_FOUNDATION public API.
在文件 PlatformEvent.h 第 93 行定义.
构造及析构函数说明
◆ ~PlatformEvent()
|
virtual |
Platform event.
在文件 PlatformEvent.cpp 第 29 行定义.
成员函数说明
◆ clear()
|
virtual |
Drops all queued messages and frees them.
被 eve::platform_event::sdl::Event 重载.
在文件 PlatformEvent.cpp 第 103 行定义.
◆ getLastData()
| std::string eve::platform_event::PlatformEvent::getLastData | ( | ) | const |
First string arg of the message most recently returned by pollName/pollData.
在文件 PlatformEvent.cpp 第 86 行定义.
引用了 lastData_.
◆ Module_REG()
| eve::platform_event::PlatformEvent::Module_REG | ( | PlatformEvent | ) |
◆ poll()
| Message * eve::platform_event::PlatformEvent::poll | ( | ) |
Pops the oldest message, or nullptr if the queue is empty. @ownership Ownership transfers to the caller, which must delete the message. @lifetime Valid until caller deletion; independent of subsequent queue mutation. @thread Thread-safe queue operation; observer callbacks run after unlocking. @reentrancy Poll observers may re-enter the queue.
在文件 PlatformEvent.cpp 第 53 行定义.
引用了 pollOwned().
◆ pollData()
| std::string eve::platform_event::PlatformEvent::pollData | ( | ) |
Pops one message and returns its first string arg (or ""). Name is discarded — use pollName when you need the type.
在文件 PlatformEvent.cpp 第 88 行定义.
引用了 a, lastData_, pollOwned() , 以及 eve::platform_event::Variant::String.
◆ pollName()
| std::string eve::platform_event::PlatformEvent::pollName | ( | ) |
Script helper: pops one message and returns its name, or "" if none.
在文件 PlatformEvent.cpp 第 72 行定义.
引用了 a, lastData_, n, pollOwned() , 以及 eve::platform_event::Variant::String.
◆ pollObserver()
|
inline |
Current poll observer, or empty if none.
在文件 PlatformEvent.h 第 149 行定义.
◆ pollObserverFailureCount()
|
inlinenoexcept |
Number of contained poll-listener exceptions since construction.
在文件 PlatformEvent.h 第 162 行定义.
◆ pollOwned()
| std::unique_ptr< Message > eve::platform_event::PlatformEvent::pollOwned | ( | ) |
Pops the oldest message into an RAII handle, or returns null.
在文件 PlatformEvent.cpp 第 55 行定义.
引用了 pollObserverFailures_, pollObservers_, queue , 以及 queueMu_.
被这些函数引用 poll(), pollData(), pollName() , 以及 eve::rx::Rx::pump().
◆ pump()
|
pure virtual |
Platform hook: pumps the native event queue into this module.
在 eve::platform_event::sdl::Event 内被实现.
◆ push() [1/2]
| void eve::platform_event::PlatformEvent::push | ( | Message * | msg | ) |
Queues a message. Thread-safe: workers may push completions for the main loop to poll.
- 参数
-
msg Message to queue (must be non-null; ownership transfers to the queue).
在文件 PlatformEvent.cpp 第 35 行定义.
引用了 push().
被这些函数引用 eve::platform_event::sdl::Event::pump(), push() , 以及 pushData().
◆ push() [2/2]
| void eve::platform_event::PlatformEvent::push | ( | std::unique_ptr< Message > | msg | ) |
Queues an owning message handle; ownership transfers to the queue.
在文件 PlatformEvent.cpp 第 37 行定义.
引用了 EV_PARAM_CHECK, queue, queueMu_ , 以及 wakeWaiters().
◆ pushData()
| void eve::platform_event::PlatformEvent::pushData | ( | std::string | name, |
| std::string | data = "" |
||
| ) |
Script helper: pushes an event with an optional string payload.
- 参数
-
name Event name. data Optional string payload stored as the first argument.
在文件 PlatformEvent.cpp 第 47 行定义.
◆ setPollObserver()
|
inline |
Sets an observer invoked for every message consumed via poll*().
Used by DevTools to record the per-frame input/event stream for a state-driven bug scenario (see eve::dev::ScenarioRecorder). Only one observer is active at a time; set an empty function to clear it.
- 参数
-
observer Callback receiving each polled message (may be empty).
在文件 PlatformEvent.h 第 142 行定义.
引用了 observer.
◆ subscribePoll()
| eve::Subscription eve::platform_event::PlatformEvent::subscribePoll | ( | std::function< void(const Message &)> | callback | ) |
Subscribe to every message consumed by poll/pollOwned.
- 返回
- Move-only RAII token; disposal is safe during a callback.
- 备注
- The subscription is owner-thread-affine. Dispatch snapshots listeners and contains unknown callback exceptions so a message already removed from the queue remains committed.
在文件 PlatformEvent.cpp 第 31 行定义.
引用了 callback , 以及 pollObservers_.
◆ wait()
|
pure virtual |
Platform hook: blocks until a message is available, then polls it. @ownership Ownership transfers to the caller, which must delete the message. @lifetime Valid until caller deletion and independent of the platform queue. @thread Call on the platform event thread. @reentrancy Does not invoke script while blocked.
在 eve::platform_event::sdl::Event 内被实现.
◆ waitOwned()
|
inline |
Blocking wait returning an RAII handle.
在文件 PlatformEvent.h 第 175 行定义.
◆ wakeWaiters()
|
inlineprotectedvirtual |
Wake a platform-specific blocking wait after a message is queued.
在文件 PlatformEvent.h 第 179 行定义.
被这些函数引用 push().
类成员变量说明
◆ lastData_
|
protected |
在文件 PlatformEvent.h 第 183 行定义.
被这些函数引用 getLastData(), pollData() , 以及 pollName().
◆ legacyPollSubscription_
|
protected |
在文件 PlatformEvent.h 第 187 行定义.
◆ pollObserver_
|
protected |
Void.
在文件 PlatformEvent.h 第 185 行定义.
◆ pollObserverFailures_
|
protected |
在文件 PlatformEvent.h 第 188 行定义.
被这些函数引用 pollOwned().
◆ pollObservers_
|
protected |
在文件 PlatformEvent.h 第 186 行定义.
被这些函数引用 pollOwned() , 以及 subscribePoll().
◆ queue
|
protected |
在文件 PlatformEvent.h 第 182 行定义.
被这些函数引用 clear(), pollOwned() , 以及 push().
◆ queueMu_
|
protected |
在文件 PlatformEvent.h 第 181 行定义.
被这些函数引用 clear(), pollOwned() , 以及 push().
该类的文档由以下文件生成:
- src/modules/platform_event/PlatformEvent.h
- src/modules/platform_event/PlatformEvent.cpp
Public 成员函数 继承自