MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ cancel_event() [1/2]

bool MayaFlux::Vruta::EventManager::cancel_event ( const std::shared_ptr< Event > &  event)

Cancels and removes a event from the manager.

Parameters
eventShared pointer to the event to cancel
Returns
True if the event was found and cancelled, false otherwise

This method removes a event from the manager, preventing it from executing further. It's used to stop events that are no longer needed or to clean up before shutting down the engine. The event is detached from the manager before termination is requested.

Definition at line 46 of file EventManager.cpp.

47{
48
49 auto it = std::ranges::find(m_events, event);
50 if (it != m_events.end()) {
51 auto owned = std::move(*it);
52 m_events.erase(it);
53 std::erase_if(m_named_events, [&owned](const auto& pair) {
54 return pair.second == owned;
55 });
56
57 if (owned && owned->is_active()) {
58 owned->set_should_terminate(true);
59 }
60 return true;
61 }
62
63 return false;
64}
std::unordered_map< std::string, std::shared_ptr< Event > > m_named_events
std::vector< std::shared_ptr< Event > > m_events

References m_events, and m_named_events.

Referenced by MayaFlux::Portal::Forma::Context::cancel_handlers(), MayaFlux::Nexus::Fabric::remove(), and MayaFlux::Nexus::Fabric::~Fabric().

+ Here is the caller graph for this function: