Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

DALT_Server::EntityFactory Class Reference

This class provides a centralised point for creating new Entities. More...

#include <entity_factory.h>

List of all members.

Public Methods

 EntityFactory ()
 ~EntityFactory ()
EntitycreateEntity (string type, vector< int > &position, list< Entity > &existing_entities)
bool existsId (int id, list< Entity > &avail)

Private Attributes

unsigned long int last_id
bool check_existing_ids


Detailed Description

This class provides a centralised point for creating new Entities.

It's most important function is managing the generation of unique ids for the entites.

This class is instantiated in entity_factory.cpp and its instance is made available through the entity_factory pointer.

Author:
Vlad Mereuta


Constructor & Destructor Documentation

DALT_Server::EntityFactory::EntityFactory ( )
 

DALT_Server::EntityFactory::~EntityFactory ( )
 


Member Function Documentation

Entity * DALT_Server::EntityFactory::createEntity ( string type,
vector< int > & position,
list< Entity > & existing_entities )
 

creates a new entity and returns a pointer to it.

Parameters:
type   entity type
position   vector containing the position of this entity
existing_entities   vector of entities which need to be checked for existing ids when alocating a new id
Returns:
a pointer to the newly created entitiy
Parameters:
type  
position  
existing_entities  

bool DALT_Server::EntityFactory::existsId ( int id,
list< Entity > & avail )
 

checks whether the given id is already owned by an entity.

Parameters:
id   the id
avail   available entities to be checked
Returns:
true if an entity with the given id exists, false otherwise
Parameters:
id  
avail  


Member Data Documentation

bool DALT_Server::EntityFactory::check_existing_ids [private]
 

flag dictating whether the factory needs to check each id for existance.

unsigned long int DALT_Server::EntityFactory::last_id [private]
 

the ID which has been allocated to the last created entity.


The documentation for this class was generated from the following file:
Generated at Thu Jan 31 15:22:41 2002 for DALT Server by doxygen1.2.8 written by Dimitri van Heesch, © 1997-2001