9 #include "imstkTimer.h" 10 #include "imstkEventObject.h" 36 ~
Module()
override =
default;
63 double getDt()
const {
return m_dt; }
64 void setDt(
const double dt) { m_dt = dt; }
75 void setPaused(
const bool paused) { m_paused = paused; }
81 bool getMuteUpdateEvents()
const {
return m_muteUpdateEvents; }
87 void setExecutionType(
const ExecutionType type) { m_executionType = type; }
89 void setSleepDelay(
const double ms);
90 double getSleepDelay()
const {
return m_sleepDelay; }
92 void pause() { m_paused =
true; }
93 void resume() { m_paused =
false; }
95 void init() { m_init = initModule(); }
101 virtual bool initModule() = 0;
103 virtual void updateModule() = 0;
105 virtual void uninitModule() { }
108 std::atomic<bool> m_init = ATOMIC_VAR_INIT(
false);
109 std::atomic<bool> m_paused = ATOMIC_VAR_INIT(
false);
112 bool m_muteUpdateEvents =
false;
113 double m_sleepDelay = 0.0;
virtual const std::string getTypeName() const =0
Returns collision detection type string name.
ExecutionType
Currently 3 execution types are provided. These inform the driver on how it should run...
bool getPaused() const
Set/Get whether the module is currently paused.
ExecutionType getExecutionType() const
Set/Get the execution type (see imstk::ExecutionType)
bool getInit() const
Get whether the module is initialized yet.
double getDt() const
Get/Set the time step.
void setMuteUpdateEvents(const bool mute)
Set/Get whether the module should post pre/post update events.
EventObject is the base class for all objects in iMSTK that can receive and emit events. It supports direct and queued observer functions. Direct observers receive events immediately on the same thread This can either be posted on an object or be a function pointer Queued observers receive events within their queue which they can process whenever they like. These can be connected with the connect/queuedConnect/disconnect functions Lambda recievers cannot be disconnected unless all receivers to a signal are removed.
SIGNAL(Module, preUpdate)
Posted before updateModule is called.
Base class for imstk module system. A module defines something that is updated, and can be paused/res...