engine-mk1
Public Member Functions | List of all members
rz::core::Entity Class Reference

The Entity class used for storing and getting Component Handles. More...

#include <Entity.hpp>

Public Member Functions

 Entity () noexcept
 Default constructor. More...
 
 Entity (ComponentMap components)
 Constructs an Entity object from a pre-constructed map of Component objects. More...
 
const Handleoperator[] (ComponentType type) const
 Gets the Handle mapped to the passed ComponentType. More...
 
bool operator== (const Entity &rhs) const noexcept
 
bool operator!= (const Entity &rhs) const noexcept
 
ComponentHandle addComponent (ComponentHandle component)
 Adds a ComponentHandle to the ComponentMap of Entity. More...
 
void removeComponent (ComponentHandle component)
 Removes a ComponentHandle from the ComponentMap of Entity. More...
 
template<typename... Types>
bool has (Types...types) const
 
ComponentMap getComponents ()
 Gets the current ComponentMap of the Entity. More...
 
const UUID64getID () const noexcept
 Gets the unique ID of this Entity. More...
 

Detailed Description

The Entity class used for storing and getting Component Handles.

For more information and examples, see page Core.

Constructor & Destructor Documentation

rz::core::Entity::Entity ( )
inlinenoexcept

Default constructor.

rz::core::Entity::Entity ( ComponentMap  components)
inline

Constructs an Entity object from a pre-constructed map of Component objects.

Parameters
componentsThe ComponentMap of components to initialize this Entity with.

Member Function Documentation

ComponentHandle rz::core::Entity::addComponent ( ComponentHandle  component)
inline

Adds a ComponentHandle to the ComponentMap of Entity.

Parameters
componentThe ComponentHandle to add.
Return values
ComponentHandleThe passed ComponentHandle on success.
ComponentMap rz::core::Entity::getComponents ( )
inline

Gets the current ComponentMap of the Entity.

Returns
The current ComponentMap of the Entity
const UUID64& rz::core::Entity::getID ( ) const
inlinenoexcept

Gets the unique ID of this Entity.

Returns
The unique id of this Entity.
const Handle& rz::core::Entity::operator[] ( ComponentType  type) const
inline

Gets the Handle mapped to the passed ComponentType.

Parameters
typeThe ComponentType to search for.
Exceptions
std::invalid_argumentThrows if the ComponentType maps to no Handle.
Returns
A reference to the mapped Handle.
void rz::core::Entity::removeComponent ( ComponentHandle  component)
inline

Removes a ComponentHandle from the ComponentMap of Entity.

Parameters
componentThe ComponentHandle to remove.

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