Nemo  2.3.46
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 ~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

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

Constructor & Destructor Documentation

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

Member Function Documentation

virtual void StatHandlerBase::add ( StatRecBase rec)
inlinevirtual

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

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

References StatServices::get_pop_ptr().

Referenced by init().

71 {return _service->get_pop_ptr();}
Metapop * get_pop_ptr()
Definition: statservices.h:106
StatServices * _service
Link to the StatService.
Definition: stathandler.h:55
StatServices* StatHandlerBase::get_service ( )
inline

References _service.

75 {return _service;}
StatServices * _service
Link to the StatService.
Definition: stathandler.h:55
unsigned int StatHandlerBase::getCurrentOccurrence ( )
inline

References StatServices::getCurrentOccurrence().

81 {return _service->getCurrentOccurrence();}
StatServices * _service
Link to the StatService.
Definition: stathandler.h:55
unsigned int getCurrentOccurrence()
Returns the last generation recorded for current replicate.
Definition: statservices.h:136
unsigned int StatHandlerBase::getNbRecorders ( )
inline
83 {return _stats.size();}
std::list< StatRecBase * > _stats
Link to the StatRecorder list elements in the StatHandler derived class.
Definition: stathandler.h:52
unsigned int StatHandlerBase::getNumOccurrences ( )
inline

References StatServices::getNumOccurrences().

79 {return _service->getNumOccurrences();}
unsigned int getNumOccurrences()
Returns the maximum number of generation records per replicate.
Definition: statservices.h:126
StatServices * _service
Link to the StatService.
Definition: stathandler.h:55
unsigned int StatHandlerBase::getOccurrence ( )
inline

References StatServices::getOccurrence().

77 {return _service->getOccurrence();}
StatServices * _service
Link to the StatService.
Definition: stathandler.h:55
unsigned int getOccurrence()
Definition: statservices.h:118
std::list<StatRecBase*>& StatHandlerBase::getStats ( )
inline

References _stats.

85 {return _stats;}
std::list< StatRecBase * > _stats
Link to the StatRecorder list elements in the StatHandler derived class.
Definition: stathandler.h:52
void StatHandlerBase::init ( )
virtual

Implements Handler.

Reimplemented in TTNeutralGenesSH, TTQuantiSH, and TTDispersalSH.

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

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

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
void fatal(const char *str,...)
Definition: output.cc:90
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
static unsigned int getGenerations()
Definition: simenv.h:61
void StatHandlerBase::reset ( )
virtual

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

References _stats, and clear().

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
std::list< StatRecBase * > _stats
Link to the StatRecorder list elements in the StatHandler derived class.
Definition: stathandler.h:52
void StatHandlerBase::set_service ( StatServices srv)
inline

Referenced by StatServices::attach().

73 {_service = srv;}
StatServices * _service
Link to the StatService.
Definition: stathandler.h:55
virtual bool StatHandlerBase::setStatRecorders ( std::string &  token)
pure virtual
virtual void StatHandlerBase::update ( )
inlinevirtual

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

Implements Handler.

96 { }

Member Data Documentation

Metapop* StatHandlerBase::_pop
protected

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

Referenced by TTQuantiSH::addAvgPerPatch(), TTQuantiSH::addCovarPerPatch(), TTQuantiSH::addEigenPerPatch(), TTQuantiSH::addEigenValuesPerPatch(), TTQuantiSH::addEigenVect1PerPatch(), MPStatHandler::addIndNumPerPatch(), LCE_SelectionSH::addMeanPerPatch(), MPStatHandler::addPatchAge(), TTQuantiSH::addSkewPerPatch(), TTBDMI_SH::addStats(), TTQuantiSH::addVarPerPatch(), LCE_SelectionSH::addVarPerPatch(), TTNeutralGenesSH::allocateTables(), TTNeutralGenesSH::getDxy(), TTNeutralGenesSH::getDxyPerPatch(), TTDeletMutBitstrSH::getLoad(), TTDispersalSH::getMeanDispRate(), TTDeletMutBitstrSH::getMeanFecWithPatchMate(), TTWolbachiaSH::getMeanFemaleInfection_perPatch(), TTDispersalSH::getMeanFemDispRate(), TTDispersalSH::getMeanMalDispRate(), TTWolbachiaSH::getMeanMaleInfection_perPatch(), TTWolbachiaSH::getMeanOffsprgFemaleInfection_perPatch(), TTWolbachiaSH::getMeanOffsprgInfection(), TTWolbachiaSH::getMeanOffsprgMaleInfection_perPatch(), LCE_SelectionSH::getMeanPatchFitness(), TTDispersalSH::getOffsprgMeanDispRate(), TTDeletMutBitstrSH::getPatchLoad(), LCE_SelectionSH::getVarPatchFitness(), init(), TTDispersalSH::init(), TTQuantiSH::init(), TTNeutralGenesSH::setAlleleTables(), 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(), TTDeletMutBitstrSH::setLethalEquivalents(), TTNeutralGenesSH::setLociDivCounter(), TTDeletMutBitstrSH::setMeanViability(), TTNeutralGenesSH::setNeiGeneticDistance(), TTNeutralGenesSH::setNeiGeneticDistanceRecorders(), TTWolbachiaSH::setStatRecorders(), TTBDMI_SH::setStats(), TTQuantiSH::setStats(), MPStatHandler::setStatsForMigrantsPerPatch(), and TTDeletMutBitstrSH::setViability().

StatServices* StatHandlerBase::_service
private

Link to the StatService.

Referenced by get_service().

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

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

Referenced by getStats(), and reset().


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

Generated for Nemo v2.3.0 by  doxygen 1.8.8 --
Catalogued on GSR