Simpact Cyan
Population based event driven simulation using mNRM
populationinterfaces.h
Go to the documentation of this file.
1 #ifndef POPULATIONINTERFACES_H
2 
3 #define POPULATIONINTERFACES_H
4 
9 #include "algorithm.h"
10 #include "booltype.h"
11 
12 class PersonBase;
13 class PopulationEvent;
14 
18 {
19 public:
21  virtual ~PopulationStateExtra() { }
22 };
23 
27 {
28 public:
29  PopulationStateInterface() { m_pExtraState = 0; }
31 
34  virtual PersonBase **getAllPeople() = 0;
35 
37  virtual PersonBase **getMen() = 0;
38 
40  virtual PersonBase **getWomen() = 0;
41 
44  virtual PersonBase **getDeceasedPeople() = 0;
45 
47  virtual int getNumberOfPeople() const = 0;
48 
50  virtual int getNumberOfMen() const = 0;
51 
53  virtual int getNumberOfWomen() const = 0;
54 
56  virtual int getNumberOfDeceasedPeople() const = 0;
57 
62  virtual void addNewPerson(PersonBase *pPerson) = 0;
63 
68  virtual void setPersonDied(PersonBase *pPerson) = 0;
69 
73  virtual void markAffectedPerson(PersonBase *pPerson) const = 0;
74 
78  void setExtraStateInfo(PopulationStateExtra *pExtra) { m_pExtraState = pExtra; }
79 
82  PopulationStateExtra *getExtraStateInfo() const { return m_pExtraState; }
83 private:
84  PopulationStateExtra *m_pExtraState;
85 };
86 
90 {
91 public:
94 
97  virtual void onAboutToFire(PopulationEvent *pEvt) = 0;
98 };
99 
102 {
103 public:
105  virtual ~PopulationAlgorithmInterface() { }
106 
108  virtual bool_t init() = 0;
109 
121  virtual bool_t run(double &tMax, int64_t &maxEvents, double startTime = 0) = 0;
122 
129  virtual void setAboutToFireAction(PopulationAlgorithmAboutToFireInterface *pAction) = 0;
130 
133  virtual void onNewEvent(PopulationEvent *pEvt) = 0;
134 
136  virtual double getTime() const = 0;
137 
139  virtual GslRandomNumberGenerator *getRandomNumberGenerator() const = 0;
140 };
141 
145 {
146 public:
147  PersonAlgorithmInfo() { }
148  virtual ~PersonAlgorithmInfo() { }
149 };
150 
151 #endif // POPULATIONINTERFACES_H
Base class to be able to store algorithm-specific information in the PersonBase object for a person i...
Definition: populationinterfaces.h:144
Type to return true/false with error description.
Definition: booltype.h:25
This is a base class describing the simulation state of an mNRM algorithm.
Definition: algorithm.h:23
Base class to allow some extra information to be stored in each state that implements PopulationState...
Definition: populationinterfaces.h:17
void setExtraStateInfo(PopulationStateExtra *pExtra)
This allows you to store additional information for a state that implements this PopulationStateInter...
Definition: populationinterfaces.h:78
PopulationStateExtra * getExtraStateInfo() const
Retrieves the PopulationStateExtra instance that was stored using PopulationStateInterface::setExtraS...
Definition: populationinterfaces.h:82
This class allows you to generate random numbers, and uses the GNU Scientific Library for this...
Definition: gslrandomnumbergenerator.h:16
This is the base class for events in population-based simulations.
Definition: populationevent.h:63
An interface to allow a member function PopulationAlgorithmAboutToFireInterface::onAboutToFire to be ...
Definition: populationinterfaces.h:89
This is the base class for a person in a population-based simulation.
Definition: personbase.h:23
An interface for a population based mNRM algorithm.
Definition: populationinterfaces.h:101
Interface for a simulation state for the population-based algorithm, specifying member functions that...
Definition: populationinterfaces.h:26