#include <Replication.h>
Public Member Functions | |
void | setColony (Colony *c) |
Set the Colony. | |
virtual | ~Replication () |
Empty Destructor. | |
virtual std::list< Worshiper * > * | getNewWorshipers ()=0 |
Get the list of new Worshipers to put into the World. | |
virtual Worshiper * | createWorshiper (unsigned int size, unsigned int food, Behaviour *b) |
Create a worshiper. | |
virtual void | addSurvivor (Worshiper *w) |
Is called when a worshiper comes back to the colony. | |
Protected Member Functions | |
Replication () | |
Protected constructor. | |
unsigned int | getNbWorshipers () |
Get the number of worshipers created since the beginning. | |
unsigned int | getFood () const |
Get the food quantity of the colony. | |
unsigned int | getNbCells () const |
Get the number of cells of the colony. | |
Protected Attributes | |
std::list< Worshiper * > * | _new_worshipers |
The new worshipers to add into the world. | |
Private Attributes | |
Colony * | _colony |
The colony. |
Definition at line 37 of file Replication.h.
unsigned int Replication::getNbWorshipers | ( | ) | [protected] |
Get the number of worshipers created since the beginning.
Definition at line 43 of file Replication.cpp.
References _colony, and Colony::getNbWorshipers().
00043 { 00044 return _colony->getNbWorshipers(); 00045 }
unsigned int Replication::getFood | ( | ) | const [protected] |
Get the food quantity of the colony.
Definition at line 51 of file Replication.cpp.
References _colony, and Colony::getFood().
Referenced by GeneticReplication::getNewWorshipers().
unsigned int Replication::getNbCells | ( | ) | const [protected] |
Get the number of cells of the colony.
Definition at line 47 of file Replication.cpp.
References _colony, and Colony::getNbCells().
Referenced by GeneticReplication::getNewWorshipers().
00047 { 00048 return _colony->getNbCells(); 00049 }
void Replication::setColony | ( | Colony * | c | ) |
Set the Colony.
c | colony |
Definition at line 39 of file Replication.cpp.
References _colony.
Referenced by Colony::Colony().
00039 { 00040 _colony = c; 00041 }
virtual std::list<Worshiper*>* Replication::getNewWorshipers | ( | ) | [pure virtual] |
Get the list of new Worshipers to put into the World.
Implemented in GeneticReplication, and HeuristicReplication.
Referenced by Colony::getNewWorshipers().
Worshiper * Replication::createWorshiper | ( | unsigned int | size, | |
unsigned int | food, | |||
Behaviour * | b | |||
) | [virtual] |
Create a worshiper.
size | Size of the worshiper | |
food | his initial food | |
b | his behaviour |
Definition at line 55 of file Replication.cpp.
References _colony, and Colony::createWorshiper().
Referenced by GeneticReplication::createWorshiper(), and HeuristicReplication::getNewWorshipers().
00056 { 00057 return _colony->createWorshiper(size, food, b); 00058 }
void Replication::addSurvivor | ( | Worshiper * | w | ) | [virtual] |
Is called when a worshiper comes back to the colony.
w | survivor |
Reimplemented in GeneticReplication.
Definition at line 60 of file Replication.cpp.
Referenced by Colony::addSurvivor().