Nemo  2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
StatHandlerBase Class Referenceabstract

Base class of the StatHandler class, implements the Handler interface. More...

#include <stathandler.h>

+ Inheritance diagram for StatHandlerBase:
+ Collaboration diagram for StatHandlerBase:

Public Member Functions

 StatHandlerBase ()
 
virtual ~StatHandlerBase ()
 
virtual void reset ()
 Empties the _stats list and calls clear() (defined in the derived class). More...
 
Accessors
Metapopget_pop_ptr ()
 
void set_service (StatServices *srv)
 
StatServicesget_service ()
 
unsigned int getOccurrence ()
 
unsigned int getNumOccurrences ()
 
unsigned int getCurrentOccurrence ()
 
unsigned int getNbRecorders ()
 
std::list< StatRecBase * > & getStats ()
 
virtual void add (StatRecBase *rec)
 
Handler implementation
virtual void init ()
 
virtual void update ()
 This function is left empty as the StatServices calls StatRecorder::setVal directly. More...
 
StatHandler interface declaration
virtual bool setStatRecorders (std::string &token)=0
 
virtual void clear ()=0
 
- Public Member Functions inherited from Handler
virtual void init ()=0
 Inits state. More...
 
virtual void update ()=0
 Updates the handler state. More...
 
virtual ~Handler ()
 

Protected Attributes

Metapop_pop
 Link to the current population, set through the link to the StatService. More...
 

Private Types

typedef std::list< StatRecBase * >::iterator STAT_IT
 

Private Attributes

std::list< StatRecBase * > _stats
 Link to the StatRecorder list elements in the StatHandler derived class. More...
 
StatServices_service
 Link to the StatService. More...
 

Detailed Description

Base class of the StatHandler class, implements the Handler interface.

This class stores the Handler state and the list of links to the StatRecBase. This list is duplicated in the StatHandler as a list of the StatRecorder templates. It allows the StatService to access the stat recorders without knowledge of the actual StatHandler and StatRecorder template type.

Member Typedef Documentation

◆ STAT_IT

typedef std::list<StatRecBase*>::iterator StatHandlerBase::STAT_IT
private

Constructor & Destructor Documentation

◆ StatHandlerBase()

StatHandlerBase::StatHandlerBase ( )
inline
65: _service(0) {}
StatServices * _service
Link to the StatService.
Definition: stathandler.h:55

◆ ~StatHandlerBase()

virtual StatHandlerBase::~StatHandlerBase ( )
inlinevirtual
67{ }

Member Function Documentation

◆ add()

virtual void StatHandlerBase::add ( StatRecBase rec)
inlinevirtual
87{_stats.push_back(rec);}
std::list< StatRecBase * > _stats
Link to the StatRecorder list elements in the StatHandler derived class.
Definition: stathandler.h:52

References _stats.

Referenced by StatHandler< SH >::add().

+ Here is the caller graph for this function:

◆ clear()

◆ get_pop_ptr()

Metapop * StatHandlerBase::get_pop_ptr ( )
inline
71{return _service->get_pop_ptr();}
Metapop * get_pop_ptr()
Definition: statservices.h:106

References _service, and StatServices::get_pop_ptr().

Referenced by init().

+ Here is the caller graph for this function:

◆ get_service()

StatServices * StatHandlerBase::get_service ( )
inline
75{return _service;}

References _service.

◆ getCurrentOccurrence()

unsigned int StatHandlerBase::getCurrentOccurrence ( )
inline
unsigned int getCurrentOccurrence()
Returns the last generation recorded for current replicate.
Definition: statservices.h:136

References _service, and StatServices::getCurrentOccurrence().

◆ getNbRecorders()

unsigned int StatHandlerBase::getNbRecorders ( )
inline
83{return _stats.size();}

References _stats.

◆ getNumOccurrences()

unsigned int StatHandlerBase::getNumOccurrences ( )
inline
79{return _service->getNumOccurrences();}
unsigned int getNumOccurrences()
Returns the maximum number of generation records per replicate.
Definition: statservices.h:126

References _service, and StatServices::getNumOccurrences().

◆ getOccurrence()

unsigned int StatHandlerBase::getOccurrence ( )
inline
77{return _service->getOccurrence();}
unsigned int getOccurrence()
Definition: statservices.h:118

References _service, and StatServices::getOccurrence().

◆ getStats()

std::list< StatRecBase * > & StatHandlerBase::getStats ( )
inline
85{return _stats;}

References _stats.

◆ init()

void StatHandlerBase::init ( )
virtual

Implements Handler.

Reimplemented in TTDispersalSH, TTNeutralGenesSH, and TTQuantiSH.

40{
41 _pop = get_pop_ptr();
42
43 if(SIMenv::getGenerations() == 0)
44 fatal("cannot initialize stat recorders, generation nbr is null\n");
45
46 if(SIMenv::getReplicates() == 0)
47 fatal("cannot initialize stat recorders, replicate nbr is null\n");
48
49}
static unsigned int getReplicates()
Definition: simenv.h:63
static unsigned int getGenerations()
Definition: simenv.h:61
Metapop * get_pop_ptr()
Definition: stathandler.h:71
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
void fatal(const char *str,...)
Definition: output.cc:96

References _pop, fatal(), get_pop_ptr(), SIMenv::getGenerations(), and SIMenv::getReplicates().

Referenced by TTDispersalSH::init(), and TTQuantiSH::init().

+ Here is the caller graph for this function:

◆ reset()

void StatHandlerBase::reset ( )
virtual

Empties the _stats list and calls clear() (defined in the derived class).

54{
55 STAT_IT IT = _stats.begin();
56
57 while(IT != _stats.end()) {
58 delete (*IT);
59 IT++;
60 }
61
62 _stats.clear();
63
64 clear();
65}
std::list< StatRecBase * >::iterator STAT_IT
Definition: stathandler.h:57
virtual void clear()=0

References _stats, and clear().

◆ set_service()

void StatHandlerBase::set_service ( StatServices srv)
inline
73{_service = srv;}

References _service.

Referenced by StatServices::attach().

+ Here is the caller graph for this function:

◆ setStatRecorders()

virtual bool StatHandlerBase::setStatRecorders ( std::string &  token)
pure virtual

◆ update()

virtual void StatHandlerBase::update ( )
inlinevirtual

This function is left empty as the StatServices calls StatRecorder::setVal directly.

Implements Handler.

96{ }

Member Data Documentation

◆ _pop

Metapop* StatHandlerBase::_pop
protected

Link to the current population, set through the link to the StatService.

Referenced by TTQuantiSH::addAvgPerPatch(), TTQuantiSH::addCovarPerPatch(), TTDispersalSH::addDispPerPatch(), TTQuantiSH::addEigenPerPatch(), TTQuantiSH::addEigenValuesPerPatch(), TTQuantiSH::addEigenVect1PerPatch(), MPStatHandler::addIndNumPerPatch(), LCE_SelectionSH::addMeanPerPatch(), MPStatHandler::addPatchAge(), TTQuantiSH::addQuanti(), TTQuantiSH::addSkewPerPatch(), TTBDMI_SH::addStats(), LCE_SelectionSH::addVarPerPatch(), TTQuantiSH::addVarPerPatch(), TTNeutralGenesSH::allocateTables(), MPStatHandler::getAdultSexRatio(), TTNeutralGenesSH::getDxy(), TTNeutralGenesSH::getDxyPerPatch(), MPStatHandler::getEmigrantInPatch(), MPStatHandler::getFemNumber(), MPStatHandler::getImigrateInPatch(), MPStatHandler::getKolonisersInPatch(), TTDeletMutBitstrSH::getLoad(), MPStatHandler::getMalNumber(), MPStatHandler::getMeanAssignedFecundity(), TTDispersalSH::getMeanDispRate(), TTDispersalSH::getMeanDispRateInPatch(), MPStatHandler::getMeanEmigrantPerPatch(), TTDeletMutBitstrSH::getMeanFecWithPatchMate(), TTWolbachiaSH::getMeanFemaleInfection_perPatch(), TTDispersalSH::getMeanFemDispRate(), MPStatHandler::getMeanImigrantPerPatch(), MPStatHandler::getMeanKolonisersPerPatch(), MPStatHandler::getMeanKolonisersProportion(), TTDispersalSH::getMeanMalDispRate(), TTWolbachiaSH::getMeanMaleInfection_perPatch(), MPStatHandler::getMeanMatings(), TTWolbachiaSH::getMeanOffsprgFemaleInfection_perPatch(), TTWolbachiaSH::getMeanOffsprgInfection(), TTWolbachiaSH::getMeanOffsprgMaleInfection_perPatch(), MPStatHandler::getMeanPatchAge(), MPStatHandler::getMeanPatchDensity(), MPStatHandler::getMeanPatchDensityVariance(), LCE_SelectionSH::getMeanPatchFitness(), MPStatHandler::getMeanPatchSize(), MPStatHandler::getMeanPatchSizePerSex(), MPStatHandler::getMeanResidantPerPatch(), MPStatHandler::getOffFemNumber(), MPStatHandler::getOffMalNumber(), TTDispersalSH::getOffsprgMeanDispRate(), MPStatHandler::getOffsprgSexRatio(), MPStatHandler::getPatchAge(), TTDeletMutBitstrSH::getPatchLoad(), MPStatHandler::getPatchSize(), MPStatHandler::getPopulationSize(), MPStatHandler::getResidantInPatch(), LCE_SelectionSH::getVarPatchFitness(), init(), TTDispersalSH::init(), TTQuantiSH::init(), TTNeutralGenesSH::setAdults_Theta(), TTNeutralGenesSH::setAlleleTables(), TTNeutralGenesSH::setCoaMatrix(), TTNeutralGenesSH::setCoaMatrixRecorders(), LCE_SelectionSH::setDataTable(), TTQuantiSH::setDataTables(), TTDeletMutBitstrSH::setDeletStats(), TTNeutralGenesSH::setDxyRecorders(), TTDeletMutBitstrSH::setFst(), TTNeutralGenesSH::setFst_li(), TTNeutralGenesSH::setFstat(), TTNeutralGenesSH::setFstat2(), TTNeutralGenesSH::setFstatWeirCockerham(), TTNeutralGenesSH::setFstatWeirCockerham_MS(), TTNeutralGenesSH::setFstMatrix(), TTNeutralGenesSH::setFstMatrixRecorders(), TTNeutralGenesSH::setHeteroTable(), TTNeutralGenesSH::setHeterozygosity(), TTNeutralGenesSH::setHo(), TTNeutralGenesSH::setHo2(), TTNeutralGenesSH::setHs(), TTNeutralGenesSH::setHs2(), TTWolbachiaSH::setInfectionStats(), MPStatHandler::setKinship(), TTDeletMutBitstrSH::setLethalEquivalents(), TTNeutralGenesSH::setLociDivCounter(), TTDeletMutBitstrSH::setMeanViability(), TTNeutralGenesSH::setNeiGeneticDistance(), TTNeutralGenesSH::setNeiGeneticDistanceRecorders(), MPStatHandler::setObsrvdExtinctionRate(), MPStatHandler::setPedegreeCount(), MPStatHandler::setReproductiveStats(), TTNeutralGenesSH::setSibStats(), TTWolbachiaSH::setStatRecorders(), TTBDMI_SH::setStats(), TTQuantiSH::setStats(), MPStatHandler::setStatsForMigrantsPerPatch(), and TTDeletMutBitstrSH::setViability().

◆ _service

StatServices* StatHandlerBase::_service
private

◆ _stats

std::list<StatRecBase*> StatHandlerBase::_stats
private

Link to the StatRecorder list elements in the StatHandler derived class.

Referenced by add(), getNbRecorders(), getStats(), and reset().


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

Generated for Nemo v2.3.56 by  doxygen 1.9.0 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR