Cogs.Core
|
A shared_pointer type pointer to a component in an entity. More...
#include <ComponentPtr.h>
Public Types | |
typedef ComponentType | value_type |
Public Member Functions | |
ComponentPtr (const std::shared_ptr< Entity > &owner) | |
Initializes a component pointer for component in the given entity. | |
ComponentPtr (std::shared_ptr< Entity > &&owner) noexcept | |
Initializes a component pointer for component in the given entity. | |
ComponentPtr (const ComponentPtr< ComponentType > &source) | |
Initializes a component pointer as a copy constructor. | |
ComponentPtr (ComponentPtr< ComponentType > &&source) noexcept | |
Initializes a component pointer using RValue constructor. | |
constexpr | ComponentPtr (std::nullptr_t) |
Construct empty instance. | |
ComponentPtr< ComponentType > & | operator= (const ComponentPtr< ComponentType > &rhs) |
ComponentPtr< ComponentType > & | operator= (ComponentPtr< ComponentType > &&rhs) noexcept |
ComponentType * | get () const |
ComponentType * | operator-> () const |
operator bool () const | |
bool conversion for checking if the component can be accessed. | |
constexpr bool | operator== (const ComponentPtr< ComponentType > &other) const |
Comparison operator. If the entity of both objects are equal the objects are considered equal. | |
void | reset () |
Reset to empty. | |
std::shared_ptr< Entity > | getEntity () const |
Get the owning entity. | |
Private Attributes | |
std::shared_ptr< Entity > | owner |
A shared_pointer type pointer to a component in an entity.
Components are by default only accessed using raw pointers. A raw component pointer cannot be saved as the object may be moved when creating more components in the component pool.
Definition at line 16 of file ComponentPtr.h.
typedef ComponentType Cogs::ComponentModel::ComponentPtr< ComponentType >::value_type |
Definition at line 20 of file ComponentPtr.h.
|
inline |
Initializes a component pointer for component in the given entity.
Definition at line 25 of file ComponentPtr.h.
|
inlinenoexcept |
Initializes a component pointer for component in the given entity.
Definition at line 31 of file ComponentPtr.h.
|
inline |
Initializes a component pointer as a copy constructor.
Definition at line 37 of file ComponentPtr.h.
|
inlinenoexcept |
Initializes a component pointer using RValue constructor.
Definition at line 43 of file ComponentPtr.h.
|
inlineconstexpr |
Construct empty instance.
Definition at line 49 of file ComponentPtr.h.
|
inline |
Definition at line 66 of file ComponentPtr.h.
|
inline |
Get the owning entity.
Definition at line 91 of file ComponentPtr.h.
|
inline |
bool conversion for checking if the component can be accessed.
Definition at line 79 of file ComponentPtr.h.
|
inline |
Definition at line 71 of file ComponentPtr.h.
|
inlinenoexcept |
Definition at line 60 of file ComponentPtr.h.
|
inline |
Definition at line 54 of file ComponentPtr.h.
|
inlineconstexpr |
Comparison operator. If the entity of both objects are equal the objects are considered equal.
Definition at line 82 of file ComponentPtr.h.
|
inline |
|
private |
Definition at line 94 of file ComponentPtr.h.