载入中...
搜索中...
未找到
eve::platform_event::PlatformEvent类 参考abstract

EVENGINE_API_FOUNDATION public API. 更多...

#include <PlatformEvent.h>

类 eve::platform_event::PlatformEvent 继承关系图:
eve::Module eve::platform_event::sdl::Event

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()

eve::platform_event::PlatformEvent::~PlatformEvent ( )
virtual

Platform event.

在文件 PlatformEvent.cpp 第 29 行定义.

成员函数说明

◆ clear()

void eve::platform_event::PlatformEvent::clear ( )
virtual

Drops all queued messages and frees them.

被 eve::platform_event::sdl::Event 重载.

在文件 PlatformEvent.cpp 第 103 行定义.

引用了 queue , 以及 queueMu_.

被这些函数引用 eve::platform_event::sdl::Event::clear().

◆ 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().

被这些函数引用 eve::platform_event::sdl::Event::wait().

◆ 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()

const std::function< void(const Message &)> & eve::platform_event::PlatformEvent::pollObserver ( ) const
inline

Current poll observer, or empty if none.

在文件 PlatformEvent.h 第 149 行定义.

◆ pollObserverFailureCount()

std::uint64_t eve::platform_event::PlatformEvent::pollObserverFailureCount ( ) const
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()

virtual void eve::platform_event::PlatformEvent::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.

参数
msgMessage 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.

参数
nameEvent name.
dataOptional string payload stored as the first argument.

在文件 PlatformEvent.cpp 第 47 行定义.

引用了 eve::platform_event::Variant::makeString() , 以及 push().

◆ setPollObserver()

void eve::platform_event::PlatformEvent::setPollObserver ( std::function< void(const Message &)>  observer)
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.

参数
observerCallback receiving each polled message (may be empty).

在文件 PlatformEvent.h 第 142 行定义.

引用了 observer.

被这些函数引用 eve::dev::ScenarioRecorder::detachObserver().

◆ 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()

virtual Message * eve::platform_event::PlatformEvent::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()

std::unique_ptr< Message > eve::platform_event::PlatformEvent::waitOwned ( )
inline

Blocking wait returning an RAII handle.

在文件 PlatformEvent.h 第 175 行定义.

◆ wakeWaiters()

virtual void eve::platform_event::PlatformEvent::wakeWaiters ( )
inlineprotectedvirtual

Wake a platform-specific blocking wait after a message is queued.

在文件 PlatformEvent.h 第 179 行定义.

被这些函数引用 push().

类成员变量说明

◆ lastData_

std::string eve::platform_event::PlatformEvent::lastData_
protected

在文件 PlatformEvent.h 第 183 行定义.

被这些函数引用 getLastData(), pollData() , 以及 pollName().

◆ legacyPollSubscription_

eve::Subscription eve::platform_event::PlatformEvent::legacyPollSubscription_
protected

在文件 PlatformEvent.h 第 187 行定义.

◆ pollObserver_

std::function<void(const Message&)> eve::platform_event::PlatformEvent::pollObserver_
protected

Void.

在文件 PlatformEvent.h 第 185 行定义.

◆ pollObserverFailures_

std::uint64_t eve::platform_event::PlatformEvent::pollObserverFailures_ = 0
protected

在文件 PlatformEvent.h 第 188 行定义.

被这些函数引用 pollOwned().

◆ pollObservers_

eve::Observer<Message> eve::platform_event::PlatformEvent::pollObservers_
protected

在文件 PlatformEvent.h 第 186 行定义.

被这些函数引用 pollOwned() , 以及 subscribePoll().

◆ queue

std::queue<std::unique_ptr<Message> > eve::platform_event::PlatformEvent::queue
protected

在文件 PlatformEvent.h 第 182 行定义.

被这些函数引用 clear(), pollOwned() , 以及 push().

◆ queueMu_

std::mutex eve::platform_event::PlatformEvent::queueMu_
protected

在文件 PlatformEvent.h 第 181 行定义.

被这些函数引用 clear(), pollOwned() , 以及 push().


该类的文档由以下文件生成: