QSDK 1.1 Documentation
Main Page | Modules | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

Q::EntityFactory Struct Reference
[Entity platform]

The base interface to create Entities. More...

#include <Q/gamedev.h>

Inheritance diagram for Q::EntityFactory:

Com::Unknown Q::EntityFactoryBase List of all members.

Public Types

typedef Com::Ptr< EntityFactoryPTR

Public Member Functions

virtual Utils::Result get (const Concept &type, Entity **)=0
virtual Utils::Result recycle (Entity *)=0

Static Public Attributes

Com::UUID IID

Detailed Description

The base interface to create Entities.

Factory for Entity. This interface needs to be implemented by the client. It controls the construction and destruction of Entity objects. EntityFactory::get is called when the EntityManager needs an entity of a particular type to activate and EntityFactory::recycle is called when the EntityManager has deactivated the object. Whether the EntityFactory explicitly creates and destroys objects on EntityFactory::get and EntityFactory::recycle or recycles them is purely up to the implementation of the factory.

See also:
Entity

EntityManager

EntityFactoryBase


Member Typedef Documentation

typedef Com::Ptr<EntityFactory> Q::EntityFactory::PTR
 

A COM pointer to an object of this class

Reimplemented in Q::EntityFactoryBase.


Member Function Documentation

virtual Utils::Result Q::EntityFactory::get const Concept type,
Entity ** 
[pure virtual]
 

This method gets called when the EntityManager needs an entity of a particular type to activate.

Note:
If the implementation creates the Entity component and passes it back to the pointer pointer, it has to make sure its reference count is one. If it passes back a reference on an already created Entity component, it must increase its reference count by one. For more details, read the COM FAQ.
See also:
SchemaFactory::nameToConcept()

virtual Utils::Result Q::EntityFactory::recycle Entity  )  [pure virtual]
 

This method gets called when the EntityManager deactivates an entity.

Note:
when this function gets called, the reference count of the Entity is the same one as it was when it was returned by EntityFactory::get, plus one. At this point, the GDK engine has released all extra references it held and only holds a last one, which will be release just after the call to recycle.


Member Data Documentation

Com::UUID Q::EntityFactory::IID [static]
 

COM IID 1af31823-8b88-4d8a-ba46-46400a996365

Reimplemented from Com::Unknown.

Return to QSDK documentation Contents page. Contact details for support, information and fault-reporting.
Qube Software Limited © 2000-2004