iMSTK
Interactive Medical Simulation Toolkit
Public Types | Public Member Functions | Protected Attributes | List of all members
imstk::SceneManager Class Reference

Scene manager module manages multiple scenes and runs the active one. More...

#include <imstkSceneManager.h>

Inheritance diagram for imstk::SceneManager:
Inheritance graph
[legend]
Collaboration diagram for imstk::SceneManager:
Collaboration graph
[legend]

Public Types

enum  Mode { Simulation, Debug }
 
- Public Types inherited from imstk::Module
enum  ExecutionType { SEQUENTIAL, PARALLEL, ADAPTIVE }
 Currently 3 execution types are provided. These inform the driver on how it should run.
 
- Public Types inherited from imstk::EventObject
using Observer = std::tuple< bool, std::weak_ptr< EventObject >, std::function< void(Event *)> >
 

Public Member Functions

 SceneManager (std::string name="SceneManager")
 
std::shared_ptr< ScenegetActiveScene () const
 Get the scene that the scene manager is managing.
 
std::shared_ptr< ScenegetScene (std::string name) const
 Search for scene by name, returns nullptr if not found.
 
Mode getMode () const
 Get the current mode.
 
void setMode (Mode mode)
 Switches the mode of the scene manager This alters the active scene.
 
bool containsScene (std::string name) const
 Returns if the SceneManager contains the scene or not.
 
void setActiveScene (std::string newSceneName)
 Sets the currently updating scene.
 
void setActiveScene (std::shared_ptr< Scene > scene)
 Sets the currently updating scene, adds if does not exist yet.
 
void addScene (std::shared_ptr< Scene > scene)
 Adds scene to the manager.
 
void removeScene (std::string name)
 Remove a scene from the manager.
 
bool initModule () override
 Initialize the thread.
 
void updateModule () override
 Run the thread.
 
- Public Member Functions inherited from imstk::Module
virtual const std::string getTypeName () const =0
 Returns collision detection type string name.
 
 SIGNAL (Module, preUpdate)
 Posted before updateModule is called.
 
 SIGNAL (Module, postUpdate)
 Posted after updateModule is called.
 
 SIGNAL (Module, end)
 Posted when module wants to end.
 
double getDt () const
 Get/Set the time step.
 
void setDt (const double dt)
 
bool getInit () const
 Get whether the module is initialized yet.
 
bool getPaused () const
 Set/Get whether the module is currently paused.
 
void setPaused (const bool paused)
 
void setMuteUpdateEvents (const bool mute)
 Set/Get whether the module should post pre/post update events.
 
bool getMuteUpdateEvents () const
 
ExecutionType getExecutionType () const
 Set/Get the execution type (see imstk::ExecutionType)
 
void setExecutionType (const ExecutionType type)
 
void setSleepDelay (const double ms)
 
double getSleepDelay () const
 
void pause ()
 
void resume ()
 
void init ()
 
void update ()
 
void uninit ()
 
virtual void uninitModule ()
 
- Public Member Functions inherited from imstk::EventObject
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::shared_ptr< Scenem_activeScene
 Scene that is being managed.
 
std::unordered_map< std::string, std::shared_ptr< Scene > > m_sceneMap
 
Mode m_mode
 
std::string m_prevCamName
 
- Protected Attributes inherited from imstk::Module
std::atomic< bool > m_init = ATOMIC_VAR_INIT(false)
 
std::atomic< bool > m_paused = ATOMIC_VAR_INIT(false)
 
double m_dt = 0.0
 
ExecutionType m_executionType = ExecutionType::PARALLEL
 
bool m_muteUpdateEvents = false
 
double m_sleepDelay = 0.0
 
- Protected Attributes inherited from imstk::EventObject
ParallelUtils::SpinLock eventQueueLock
 
std::deque< CommandeventQueue
 
std::vector< std::pair< std::string, std::vector< Observer > > > queuedObservers
 
std::vector< std::pair< std::string, std::vector< Observer > > > directObservers
 

Detailed Description

Scene manager module manages multiple scenes and runs the active one.

Definition at line 24 of file imstkSceneManager.h.


The documentation for this class was generated from the following files: