Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CEntityHandle Class Reference

Object wrapping an entity_id_t, with a SEntityComponentCache to support fast QueryInterface() / CmpPtr<>() calls. More...

#include <Entity.h>

Collaboration diagram for CEntityHandle:

Public Member Functions

 CEntityHandle ()
 
 CEntityHandle (entity_id_t id, SEntityComponentCache *componentCache)
 
entity_id_t GetId () const
 
SEntityComponentCacheGetComponentCache () const
 

Private Attributes

entity_id_t m_Id
 
SEntityComponentCachem_ComponentCache
 

Detailed Description

Object wrapping an entity_id_t, with a SEntityComponentCache to support fast QueryInterface() / CmpPtr<>() calls.

Components can use IComponent::GetSystemEntity() and IComponent::GetEntityHandle() to get handles to SYSTEM_ENTITY and themselves, and then pass those handles around.

Be careful not to store a CEntityHandle for longer than the lifetime of the entity (listen to MT_Destroy messages to know when to release it) - otherwise the handle will contain a dangling pointer and will probably crash.

Constructor & Destructor Documentation

◆ CEntityHandle() [1/2]

CEntityHandle::CEntityHandle ( )
inline

◆ CEntityHandle() [2/2]

CEntityHandle::CEntityHandle ( entity_id_t  id,
SEntityComponentCache componentCache 
)
inline

Member Function Documentation

◆ GetComponentCache()

SEntityComponentCache * CEntityHandle::GetComponentCache ( ) const
inline

◆ GetId()

entity_id_t CEntityHandle::GetId ( ) const
inline

Member Data Documentation

◆ m_ComponentCache

SEntityComponentCache* CEntityHandle::m_ComponentCache
private

◆ m_Id

entity_id_t CEntityHandle::m_Id
private

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