Replication Class Reference

#include <Replication.h>

Inheritance diagram for Replication:

Inheritance graph
[legend]
Collaboration diagram for Replication:

Collaboration graph
[legend]

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 WorshipercreateWorshiper (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.

Detailed Description

< The replication strategy interface

Definition at line 37 of file Replication.h.


Member Function Documentation

unsigned int Replication::getNbWorshipers (  )  [protected]

Get the number of worshipers created since the beginning.

Returns:
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 }

Here is the call graph for this function:

unsigned int Replication::getFood (  )  const [protected]

Get the food quantity of the colony.

Returns:
the food quantity of the colony

Definition at line 51 of file Replication.cpp.

References _colony, and Colony::getFood().

Referenced by GeneticReplication::getNewWorshipers().

00051                                         {
00052   return _colony->getFood();
00053 }

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int Replication::getNbCells (  )  const [protected]

Get the number of cells of the colony.

Returns:
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 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Replication::setColony ( Colony c  ) 

Set the Colony.

Parameters:
c colony

Definition at line 39 of file Replication.cpp.

References _colony.

Referenced by Colony::Colony().

00039                                       {
00040   _colony = c;
00041 }

Here is the caller graph for this function:

virtual std::list<Worshiper*>* Replication::getNewWorshipers (  )  [pure virtual]

Get the list of new Worshipers to put into the World.

Returns:
list of new Worshipers to put into the World

Implemented in GeneticReplication, and HeuristicReplication.

Referenced by Colony::getNewWorshipers().

Here is the caller graph for this function:

Worshiper * Replication::createWorshiper ( unsigned int  size,
unsigned int  food,
Behaviour b 
) [virtual]

Create a worshiper.

Parameters:
size Size of the worshiper
food his initial food
b his behaviour
Returns:
a new worshiper

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Replication::addSurvivor ( Worshiper w  )  [virtual]

Is called when a worshiper comes back to the colony.

Parameters:
w survivor

Reimplemented in GeneticReplication.

Definition at line 60 of file Replication.cpp.

Referenced by Colony::addSurvivor().

00060                                            {
00061   //By default, delete the worshiper
00062   delete w;
00063 }

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Sat Feb 2 22:23:18 2008 for Teapot Colony Wars by  doxygen 1.5.4