april  1.0.0
...
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
april::ActorFactory Class Reference

Factory class for agents. More...

#include <actorfactory.h>

+ Inheritance diagram for april::ActorFactory:

Public Member Functions

 ActorFactory (World *w)
 constructor;
virtual FactoryType factoryType (void)
 the generic type of the factory
virtual QString factoryName (void)
 the name used to save this factory
virtual void copyDefaultDNA (DNA &destination)
 copies default DNA from internal storage to destination
virtual Actorcreate (ID id)
 create a new actor
virtual bool save (QSettings &s) const
 save to a QSettings object
virtual bool load (QSettings &s)
 load from a QSettings object
- Public Member Functions inherited from april::Factory
 Factory (World *w)
 constructor;
Worldworld (void) const
 the world that hosts us;
virtual const QString & name (ID id) const
 name of the element represented by provided ID
virtual QList< qreal > averageDNA (ID id) const
 get the default DNA sequence for a particular ID

Protected Member Functions

virtual ~ActorFactory (void)
 destructor;
DNAdefaultDNA (void)
 allow access to default dna storage
bool addMyself (ID id)
 add this class to the world
void setDNA (Actor *a, const DNA &dna)
 set the DNA in the actor
void setDNA (Actor *a)
 set default DNA in the actor
void initDNA (DNA &dna, const DNA::InitData &init)
 initialise a DNA instance
void initDNA (const DNA::InitData &init)
 initialise default DNA instance
- Protected Member Functions inherited from april::Factory
virtual ~Factory (void)
 destructor;
void setName (const QString &s)
 chang the name of the element represented by provided ID
bool setEnergy (ActorComp *comp, quint64 energy, quint64 cost)
 set the packed energy and the ammount of energy consumed on each time unit

Detailed Description

Factory class for agents.

Member Function Documentation

Actor * ActorFactory::create ( ID  id)
virtual

create a new actor

By default this method creates a simple Actor based on the default_dna_. The method fails if the id in DNA is not the same as the one that was required.

The caller recieves a reference that should eventually discard.

Parameters
idThe id that is requested
Returns
either a pointer or NULL

Reimplemented in april::GenericActorFactory.

void ActorFactory::initDNA ( DNA dna,
const DNA::InitData init 
)
protected

initialise a DNA instance

Parameters
dnatarget structure
initthe id to set in target structure

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