Go to the documentation of this file.
16 #ifndef SURGSIM_FRAMEWORK_COMPONENT_H
17 #define SURGSIM_FRAMEWORK_COMPONENT_H
22 #include <boost/uuid/uuid.hpp>
44 public std::enable_shared_from_this<Component>,
67 boost::uuids::uuid
getUuid()
const;
78 bool initialize(
const std::weak_ptr<Runtime>& runtime);
94 void setScene(std::weak_ptr<Scene> scene);
206 template <
class Target,
class Source>
214 #endif // SURGSIM_FRAMEWORK_COMPONENT_H
void setSceneElement(std::weak_ptr< SceneElement > sceneElement)
Sets the scene element.
Definition: Component.cpp:126
void setName(const std::string &name)
Sets the name of component.
Definition: Component.cpp:67
Component is the main interface class to pass information to the system managers each will decide whe...
Definition: Component.h:46
virtual void setLocalActive(bool val)
Set the component's active state.
Definition: Component.cpp:196
std::weak_ptr< Scene > m_scene
Scene which contains this component.
Definition: Component.h:174
virtual std::string getClassName() const
The class name for this class, this being the base class it should return SurgSim::Framework::Compone...
Definition: Component.cpp:163
bool isInitialized() const
Definition: Component.cpp:72
boost::uuids::uuid m_uuid
Id of this component.
Definition: Component.h:168
virtual std::shared_ptr< PoseComponent > getPoseComponent()
Get the PoseComponent for this component.
Definition: Component.cpp:152
bool isLocalActive() const
Definition: Component.cpp:201
bool isAwake() const
Definition: Component.cpp:88
bool initialize(const std::weak_ptr< Runtime > &runtime)
Initialize this component, this needs to be called before wakeUp() can be called.
Definition: Component.cpp:77
std::shared_ptr< SceneElement > getSceneElement()
Gets the scene element.
Definition: Component.cpp:131
void retire()
Retire this component, this will be called when the component is removed from the ComponentManager th...
Definition: Component.cpp:105
CRTP Base class to implement Object Factory functionality on a base class, use this rather than writi...
Definition: ObjectFactory.h:141
bool m_isInitialized
Indicates if this component is initialized.
Definition: Component.h:186
std::shared_ptr< Component > getSharedPtr()
Gets a shared pointer to this component.
Definition: Component.cpp:170
std::shared_ptr< Scene > getScene()
Gets the scene.
Definition: Component.cpp:121
Definition: CompoundShapeToGraphics.cpp:30
bool m_didWakeUp
Indicates if doWakeup() has been called.
Definition: Component.h:183
Mixin class for enabling a property system on OSS classes, the instance still needs to initialize pro...
Definition: Accessible.h:38
std::string m_name
Name of this component.
Definition: Component.h:165
bool m_didInit
Indicates if doInitialize() has been called.
Definition: Component.h:180
virtual ~Component()
Destructor.
Definition: Component.cpp:47
bool wakeUp()
Wakeup this component, this will be called when the component is inserted into the ComponentManager t...
Definition: Component.cpp:93
std::shared_ptr< Target > checkAndConvert(std::shared_ptr< Source > incoming, const std::string &expectedTypeName)
The function tries to convert the Source type to the Target type it will throw if Target is not a sub...
Definition: Component-inl.h:27
boost::uuids::uuid getUuid() const
Gets the id of the component.
Definition: Component.cpp:158
std::weak_ptr< Runtime > m_runtime
Runtime which contains this component.
Definition: Component.h:171
Component(const std::string &name)
Constructor.
Definition: Component.cpp:34
std::weak_ptr< SceneElement > m_sceneElement
SceneElement which contains this component.
Definition: Component.h:177
virtual void doRetire()
Interface to be implemented by derived classes Has a default implementation, does nothing.
Definition: Component.cpp:111
virtual bool doWakeUp()=0
Interface to be implemented by derived classes.
std::shared_ptr< Runtime > getRuntime() const
Get the runtime which contains this component.
Definition: Component.cpp:141
bool isActive() const
Definition: Component.cpp:184
bool m_isAwake
Indicates if this component is awake.
Definition: Component.h:189
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
std::string getFullName() const
Gets a string containing the name of the Component and (if it has one) its SceneElement.
Definition: Component.cpp:56
std::string getName() const
Gets component name.
Definition: Component.cpp:51
bool m_isLocalActive
Indicates if this component is active.
Definition: Component.h:192
virtual bool doInitialize()=0
Interface to be implemented by derived classes.
void setScene(std::weak_ptr< Scene > scene)
Sets the scene.
Definition: Component.cpp:116