Reference to a component. Will be valid as long as that component exists on a specific Entity, even if their pointer address has changed.
More...
#include <componentReference.h>
|
| ComponentReference () |
| Construct a new Component Reference object.
|
|
| ComponentReference (std::shared_ptr< ComponentContainer< Component > > componentContainer, Entity entity) |
| Construct a new Component Reference object.
|
|
virtual | ~ComponentReference () |
| Destroy the Component Reference object.
|
|
| operator Component * () |
| Get a volatile pointer to the component this references. Since this pointer can change when components of the same type are added and removed from the world, it is not a good idea to use this pointer for a long time.
|
|
Component * | operator-> () |
| Automatic cast of ComponentReference to their volatile Component pointer form.
|
|
template<typename Component>
class Saga::ComponentReference< Component >
Reference to a component. Will be valid as long as that component exists on a specific Entity, even if their pointer address has changed.
- Template Parameters
-
Component | type of component this reference is for. |
◆ ComponentReference() [1/2]
template<typename Component >
Construct a new Component Reference object.
◆ ComponentReference() [2/2]
template<typename Component >
Construct a new Component Reference object.
- Parameters
-
componentContainer | |
entity | |
◆ ~ComponentReference()
template<typename Component >
Destroy the Component Reference object.
◆ operator Component *()
template<typename Component >
Get a volatile pointer to the component this references. Since this pointer can change when components of the same type are added and removed from the world, it is not a good idea to use this pointer for a long time.
- Returns
- Component* a reference to the component, or nullptr if none exists.
◆ operator->()
template<typename Component >
Automatic cast of ComponentReference to their volatile Component pointer form.
- Returns
- Component* pointer to the component that this object references, or nullptr if they don't exist.
The documentation for this class was generated from the following file: