NAP
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Entity Class Reference

#include <entity.h>

Public Types

using ComponentList = std::vector< rtti::ObjectPtr< Component > >
 
using EntityList = std::vector< rtti::ObjectPtr< Entity > >
 

Public Member Functions

rtti::ObjectPtr< ComponentfindComponent (const rtti::TypeInfo &type) const
 
bool hasComponent (const rtti::TypeInfo &type) const
 
template<class T >
bool hasComponent () const
 
const ComponentListgetComponents () const
 
- Public Member Functions inherited from Resource
 Resource ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual bool init (utility::ErrorState &errorState)
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Static Public Member Functions

static constexpr const char * componentsPropertyName ()
 
static constexpr const char * childrenPropertyName ()
 
- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 

Public Attributes

ComponentList mComponents
 
EntityList mChildren
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Description

Resource part of an entity. This represents the static data that is deserialized from json and contains a list of child entities and components This class is used as a blueprint for the creation of an EntityInstance.

Inheritance diagram for Entity:
[legend]
Collaboration diagram for Entity:
[legend]

Member Typedef Documentation

◆ ComponentList

using ComponentList = std::vector<rtti::ObjectPtr<Component> >

◆ EntityList

using EntityList = std::vector<rtti::ObjectPtr<Entity> >

Member Function Documentation

◆ childrenPropertyName()

static constexpr const char* childrenPropertyName ( )
staticconstexpr
Returns
children property name

◆ componentsPropertyName()

static constexpr const char* componentsPropertyName ( )
staticconstexpr
Returns
children property name

◆ findComponent()

rtti::ObjectPtr<Component> findComponent ( const rtti::TypeInfo type) const

Find component of the specified type

Parameters
typeThe type of component to find
Returns
The found component. Null if not found

◆ getComponents()

const ComponentList& getComponents ( ) const
Returns
All the components currently on this entity

◆ hasComponent() [1/2]

bool hasComponent

Convenience function to check whether this entity has a component of the specified type

◆ hasComponent() [2/2]

bool hasComponent ( const rtti::TypeInfo type) const

Check whether this Entity has a component of the specified type

Parameters
typeThe type of component to check for

Member Data Documentation

◆ mChildren

EntityList mChildren

◆ mComponents

ComponentList mComponents