Public Member Functions | Private Member Functions | Private Attributes | List of all members
SurgSim::Framework::Scene Class Reference

Scene. Basic Container for SceneElements. More...

#include <SurgSim/Framework/Scene.h>

Inheritance diagram for SurgSim::Framework::Scene:

Public Member Functions

 Scene (std::weak_ptr< Runtime > runtime)
 Constructor. More...
 
 ~Scene ()
 Destructor. More...
 
void addSceneElement (std::shared_ptr< SceneElement > element)
 Adds a scene element to the Scene, the SceneElement will have its initialize() function called. More...
 
void removeSceneElement (std::shared_ptr< SceneElement > element)
 Removes a scene element from the Scene. More...
 
void addSceneElements (std::vector< std::shared_ptr< SceneElement >> elements)
 Invokes addSceneElement() for each element in the list. More...
 
const std::vector< std::shared_ptr< SceneElement > > & getSceneElements () const
 Gets all the scene elements in the scene. More...
 
const std::shared_ptr< SceneElementgetSceneElement (const std::string &name) const
 Retrieve a SceneElement for this scene with the given name. More...
 
std::shared_ptr< ComponentgetComponent (const std::string &elementName, const std::string &componentName) const
 Look through the scene to find a component of a named element. More...
 
std::shared_ptr< RuntimegetRuntime ()
 Gets the runtime. More...
 
YAML::Node encode () const
 Convert to a YAML::Node. More...
 
bool decode (const YAML::Node &node)
 Pull data from a YAML::Node. More...
 
SurgSim::DataStructures::Groups< std::string, std::shared_ptr< SceneElement > > & getGroups ()
 

Private Member Functions

std::shared_ptr< ScenegetSharedPtr ()
 Get a shared pointer to Scene. More...
 

Private Attributes

std::weak_ptr< Runtimem_runtime
 
std::vector< std::shared_ptr< SceneElement > > m_elements
 
boost::mutex m_sceneElementsMutex
 
SurgSim::DataStructures::Groups< std::string, std::shared_ptr< SceneElement > > m_groups
 
std::shared_ptr< Framework::Loggerm_logger
 

Detailed Description

Scene. Basic Container for SceneElements.

Constructor & Destructor Documentation

◆ Scene()

SurgSim::Framework::Scene::Scene ( std::weak_ptr< Runtime runtime)
explicit

Constructor.

Parameters
runtimeThe runtime to be used.

◆ ~Scene()

SurgSim::Framework::Scene::~Scene ( )

Destructor.

Member Function Documentation

◆ addSceneElement()

void SurgSim::Framework::Scene::addSceneElement ( std::shared_ptr< SceneElement element)

Adds a scene element to the Scene, the SceneElement will have its initialize() function called.

Parameters
elementThe element.

◆ addSceneElements()

void SurgSim::Framework::Scene::addSceneElements ( std::vector< std::shared_ptr< SceneElement >>  elements)

Invokes addSceneElement() for each element in the list.

Parameters
elementsthe list of elements to be added.

◆ decode()

bool SurgSim::Framework::Scene::decode ( const YAML::Node &  node)

Pull data from a YAML::Node.

Parameters
nodethe node to decode.
Returns
true if the decoding succeeded and the node was formatted correctly, false otherwise

◆ encode()

YAML::Node SurgSim::Framework::Scene::encode ( ) const

Convert to a YAML::Node.

Returns
A node with all the public data of this instance

◆ getComponent()

std::shared_ptr< Component > SurgSim::Framework::Scene::getComponent ( const std::string &  elementName,
const std::string &  componentName 
) const

Look through the scene to find a component of a named element.

Parameters
elementNameThe name of the element to find
componentNameThe name of the component to find
Returns
the component that was found, nullptr if no component was found

◆ getGroups()

SurgSim::DataStructures::Groups< std::string, std::shared_ptr< SceneElement > > & SurgSim::Framework::Scene::getGroups ( )
Returns
the groups of the scene

◆ getRuntime()

std::shared_ptr< Runtime > SurgSim::Framework::Scene::getRuntime ( )

Gets the runtime.

Returns
runtime The runtime for this scene.

◆ getSceneElement()

const std::shared_ptr< SceneElement > SurgSim::Framework::Scene::getSceneElement ( const std::string &  name) const

Retrieve a SceneElement for this scene with the given name.

Returns
A SceneElement with given name; Empty share_ptr<> will be returned if no such SceneElement found.

◆ getSceneElements()

const std::vector< std::shared_ptr< SceneElement > > & SurgSim::Framework::Scene::getSceneElements ( ) const

Gets all the scene elements in the scene.

Returns
The scene elements.

◆ getSharedPtr()

std::shared_ptr< Scene > SurgSim::Framework::Scene::getSharedPtr ( )
private

Get a shared pointer to Scene.

Returns
The shared pointer.

◆ removeSceneElement()

void SurgSim::Framework::Scene::removeSceneElement ( std::shared_ptr< SceneElement element)

Removes a scene element from the Scene.

Parameters
elementThe element.

Member Data Documentation

◆ m_elements

std::vector<std::shared_ptr<SceneElement> > SurgSim::Framework::Scene::m_elements
private

◆ m_groups

SurgSim::DataStructures::Groups<std::string, std::shared_ptr<SceneElement> > SurgSim::Framework::Scene::m_groups
private

◆ m_logger

std::shared_ptr<Framework::Logger> SurgSim::Framework::Scene::m_logger
private

◆ m_runtime

std::weak_ptr<Runtime> SurgSim::Framework::Scene::m_runtime
private

◆ m_sceneElementsMutex

boost::mutex SurgSim::Framework::Scene::m_sceneElementsMutex
mutableprivate

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