Pyrogenesis  trunk
Public Member Functions | Private Attributes | List of all members
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:
Collaboration graph
[legend]

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::CEntityHandle ( )
inline
CEntityHandle::CEntityHandle ( entity_id_t  id,
SEntityComponentCache componentCache 
)
inline

Member Function Documentation

SEntityComponentCache* CEntityHandle::GetComponentCache ( ) const
inline
entity_id_t CEntityHandle::GetId ( ) const
inline

Member Data Documentation

SEntityComponentCache* CEntityHandle::m_ComponentCache
private
entity_id_t CEntityHandle::m_Id
private

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