iMSTK
Interactive Medical Simulation Toolkit
|
Defines the control of modules. More...
#include <imstkModuleDriver.h>
Public Member Functions | |
virtual void | start ()=0 |
virtual void | addModule (std::shared_ptr< Module > module) |
Add a module to run. | |
virtual void | clearModules () |
Remove all modules. | |
void | requestStatus (ModuleDriverStatus status) |
ModuleDriverStatus | getStatus () const |
std::vector< std::shared_ptr< Module > > & | getModules () |
void | waitForInit () |
Wait for all modules to init. | |
![]() | |
template<typename T > | |
void | postEvent (const T &e) |
Emits the event Direct observers will be immediately called, in sync Queued observers will receive the Command in their queue for later execution, reciever must implement doEvent. | |
template<typename T > | |
void | queueEvent (const T &e) |
Queues event directly to this. | |
void | doEvent () |
Do an event, if none exists return. | |
void | doAllEvents () |
Do all the events in the event queue. | |
void | foreachEvent (std::function< void(Command cmd)> func) |
Thread safe loop over all event commands, one can implement a custom handler. | |
void | rforeachEvent (std::function< void(Command cmd)> func) |
thread safe reverse loop over all event commands, one can implement a custom handler | |
void | clearEvents () |
Removes all events from queue cleans up copies of the event. | |
Protected Attributes | |
std::vector< std::shared_ptr< Module > > | m_modules |
std::atomic< ModuleDriverStatus > | simState = { ModuleDriverRunning } |
![]() | |
ParallelUtils::SpinLock | eventQueueLock |
std::deque< Command > | eventQueue |
std::vector< std::pair< std::string, std::vector< Observer > > > | queuedObservers |
std::vector< std::pair< std::string, std::vector< Observer > > > | directObservers |
Additional Inherited Members | |
![]() | |
using | Observer = std::tuple< bool, std::weak_ptr< EventObject >, std::function< void(Event *)> > |
Defines the control of modules.
Definition at line 25 of file imstkModuleDriver.h.