#include <component.h>
Public Member Functions | |
ComponentPtr ()=default | |
ComponentPtr (ComponentType *component) | |
const std::string & | getInstancePath () const |
virtual std::string | toString () const override |
virtual Component * | toObject () const override |
virtual void | assign (const std::string &targetID, rtti::Object *targetObject) override |
ComponentType * | get () const |
ComponentType * | get () |
const ComponentType & | operator* () const |
ComponentType & | operator* () |
const ComponentType * | operator-> () const |
ComponentType * | operator-> () |
bool | operator== (const ComponentPtr< ComponentType > &other) const |
template<typename OTHER > | |
bool | operator== (const ComponentPtr< OTHER > &other) const |
template<typename OTHER > | |
bool | operator== (const OTHER *ptr) const |
bool | operator== (std::nullptr_t) const |
bool | operator!= (const ComponentPtr< ComponentType > &other) const |
template<typename OTHER > | |
bool | operator!= (const ComponentPtr< OTHER > &other) const |
template<typename OTHER > | |
bool | operator!= (const OTHER *ptr) const |
bool | operator!= (std::nullptr_t) const |
bool | operator< (const ComponentPtr< ComponentType > &other) const |
bool | operator> (const ComponentPtr< ComponentType > &other) const |
bool | operator<= (const ComponentPtr< ComponentType > &other) const |
bool | operator>= (const ComponentPtr< ComponentType > &other) const |
Typed version of ComponentPtrBase. ComponentPtr stores the path and the pointer to the target resource.
When pointing to other other components through ComponentPtrs, you can do so using a 'path' to the target component. This path can be of two forms:
Paths consisting out of multiple elements can be either relative or absolute and come in three forms:
When there are ChildEntityIDs on the path, it's possible for the ChildEntityID to be ambiguous (for example, when an entity has multiple children with the same ID). For example, consider the following entity hierarchy:
CarEntity -> WheelEntity -> TransformComponent -> WheelEntity -> TransformComponent -> WheelEntity -> TransformComponent -> WheelEntity -> TransformComponent
Pointing directly to one of these TransformComponents using a component path is not possible, because it would be ambiguous. To disambiguate which specific child entity is meant, the user can append a ':[child_index]' to the ChildEntityID on the path.
In this case, to point to the TransformComponent of the second wheel, the user would use the following path: './WheelEntity:1/TransformComponent'
|
default |
ComponentPtr | ( | ComponentType * | component | ) |
|
overridevirtual |
Assign the path to the component (including ID) and object to this pointer. Used for pointer resolving by the ResourceManager. Should not be called manually (is only public so that we can register it in RTTI)
targetID | path to the target component including ID, empty to clear |
targetObject | The component to assign, nullptr to clear |
ComponentType* get | ( | ) |
ComponentType* get | ( | ) | const |
const std::string& getInstancePath | ( | ) | const |
Returns the path to the target component including component ID
bool operator!= | ( | const ComponentPtr< ComponentType > & | other | ) | const |
bool operator!= | ( | const ComponentPtr< OTHER > & | other | ) | const |
bool operator!= | ( | const OTHER * | ptr | ) | const |
bool operator!= | ( | std::nullptr_t | ) | const |
ComponentType& operator* | ( | ) |
const ComponentType& operator* | ( | ) | const |
ComponentType* operator-> | ( | ) |
const ComponentType* operator-> | ( | ) | const |
bool operator< | ( | const ComponentPtr< ComponentType > & | other | ) | const |
bool operator<= | ( | const ComponentPtr< ComponentType > & | other | ) | const |
bool operator== | ( | const ComponentPtr< ComponentType > & | other | ) | const |
bool operator== | ( | const ComponentPtr< OTHER > & | other | ) | const |
bool operator== | ( | const OTHER * | ptr | ) | const |
bool operator== | ( | std::nullptr_t | ) | const |
bool operator> | ( | const ComponentPtr< ComponentType > & | other | ) | const |
bool operator>= | ( | const ComponentPtr< ComponentType > & | other | ) | const |
|
overridevirtual |
Returns the assigned component
|
overridevirtual |
Convert the path to a string for serialization