![]() |
MAK Legion 1.1 API Documentation
|
The EventManager manages the creation and distribution of simulation events such as Fire and Detonate. More...
Collaboration diagram for Legion::EventManager:Classes | |
| struct | CallbackData |
Public Member Functions | |
| template<typename EVENT_TYPE > | |
| EVENT_TYPE | createEvent () |
| Create an event of a given type for sending. More... | |
| virtual EventManagerHandle | handle () const |
| Get the handle to the underlying implementation. More... | |
| virtual UInt32 | addEvent (const EventInstance &iEvent) |
| Add a created event to the database for distribution. More... | |
| virtual EventId | registerEvent (const EventDescriptor ®) |
| Register event type so as to be able to access events (add/peek/get) More... | |
| virtual ParameterId | parameterId (EventId eventId, const std::string ¶meterName) |
| Get the generated parameter ID for a given event type. More... | |
| template<typename EVENT_TYPE > | |
| UInt32 | addEventCallback (Callback< void(Span< EVENT_TYPE > &)> cb) |
| Adds a callback function for an interested event type. More... | |
| template<typename EVENT_TYPE > | |
| bool | removeEventCallback (UInt32 handle) |
| Remove a callback using the handle that was returned when it the callback was added. More... | |
| template<typename EVENT_TYPE > | |
| const std::vector< const EVENT_TYPE > | getEvents () |
| Get events for this frame. More... | |
| template<typename EVENT_TYPE > | |
| const std::vector< EVENT_TYPE > | peekEvents () |
| Peek events intended for next frame. This may return an incomplete list if other threads are still creating events. More... | |
| virtual UInt32 | nextId () |
| returns the next available event ID More... | |
| virtual bool | selfReflecting () const |
| virtual void | setSelfReflecting (bool val) |
| virtual void | addInterest (const EventId eventId) |
| virtual void | removeInterest (const EventId eventId) |
Protected Member Functions | |
| EventManager (EventManagerHandle handle) | |
| Constructor. More... | |
| virtual | ~EventManager () |
| Destructor. More... | |
Static Protected Member Functions | |
| static void | callback (void *usr, EventHandle *events, UInt32 count) |
Protected Attributes | |
| std::vector< CallbackData * > | myCallbackData |
| std::atomic< int > | myNextId |
| EventManagerHandle | myHandle |
Friends | |
| class | SimulationDatabase |
The EventManager manages the creation and distribution of simulation events such as Fire and Detonate.
The event manager is created and owned by the simulation database
|
protected |
Constructor.
|
protectedvirtual |
Destructor.
|
virtual |
Add a created event to the database for distribution.
Referenced by DtVehicleSim::detonateMunition(), DtVehicleSim::fireMunition(), and main().
| UInt32 Legion::EventManager::addEventCallback | ( | Callback< void(Span< EVENT_TYPE > &)> | cb | ) |
Adds a callback function for an interested event type.
So it can be notified whenever the type of events are received This returns a handle for the callback, which is used to unregister the callback.
References callback(), Legion::EventManager::CallbackData::convertAndExecute, Legion::EventManager::CallbackData::handle, legion_eventManager_addCallback(), myCallbackData, and myHandle.
Referenced by DtVehicleSim::DtVehicleSim(), and main().
|
virtual |
|
staticprotected |
Referenced by addEventCallback(), and removeEventCallback().
| EVENT_TYPE Legion::EventManager::createEvent | ( | ) |
Create an event of a given type for sending.
References handle(), legion_eventManager_createEvent(), and myHandle.
Referenced by DtVehicleSim::detonateMunition(), DtVehicleSim::fireMunition(), and main().
| const std::vector< const EVENT_TYPE > Legion::EventManager::getEvents | ( | ) |
Get events for this frame.
References legion_eventManager_getEvents(), and myHandle.
|
virtual |
Get the handle to the underlying implementation.
Referenced by createEvent().
|
virtual |
returns the next available event ID
Referenced by DtVehicleSim::fireMunition().
|
virtual |
Get the generated parameter ID for a given event type.
Referenced by SosSignalEvent::registerEvent().
| const std::vector< EVENT_TYPE > Legion::EventManager::peekEvents | ( | ) |
Peek events intended for next frame. This may return an incomplete list if other threads are still creating events.
References legion_eventManager_peekEvents(), and myHandle.
|
virtual |
Register event type so as to be able to access events (add/peek/get)
Referenced by SosSignalEvent::registerEvent().
| bool Legion::EventManager::removeEventCallback | ( | UInt32 | handle | ) |
Remove a callback using the handle that was returned when it the callback was added.
This removes the interest of type of events.
References callback(), legion_eventManager_removeCallback(), myCallbackData, and myHandle.
Referenced by main(), and DtVehicleSim::~DtVehicleSim().
|
virtual |
|
virtual |
|
virtual |
|
friend |
|
protected |
Referenced by addEventCallback(), and removeEventCallback().
|
protected |
Referenced by addEventCallback(), createEvent(), getEvents(), peekEvents(), and removeEventCallback().
|
protected |