FIMS  v0.8.0
Loading...
Searching...
No Matches
selectivity_base.hpp
Go to the documentation of this file.
1
11#ifndef POPULATION_DYNAMICS_SELECTIVITY_BASE_HPP
12#define POPULATION_DYNAMICS_SELECTIVITY_BASE_HPP
13
14#include "../../../common/model_object.hpp"
15
16namespace fims_popdy {
17
23template <typename Type>
25 // id_g is the ID of the instance of the SelectivityBase class.
26 // this is like a memory tracker.
27 // Assigning each one its own ID is a way to keep track of
28 // all the instances of the SelectivityBase class.
29 static uint32_t
35 // increment id of the singleton selectivity class
36 this->id = SelectivityBase::id_g++;
37 }
38
39 virtual ~SelectivityBase() {}
40
46 virtual const Type evaluate(const Type& x) = 0;
47
54 virtual const Type evaluate(const Type& x, size_t pos) = 0;
55};
56
57// default id of the singleton selectivity class
58template <typename Type>
60
61} // namespace fims_popdy
62
63#endif /* POPULATION_DYNAMICS_SELECTIVITY_BASE_HPP */
The population dynamics of FIMS.
Definition catch_at_age.hpp:41
void clear_internal()
Clears the internal objects.
Definition rcpp_interface.hpp:279
FIMSObject struct that defines member types and returns the unique id.
Definition model_object.hpp:25
Base class for all selectivity functors.
Definition selectivity_base.hpp:24
virtual const Type evaluate(const Type &x, size_t pos)=0
Calculates the selectivity.
virtual const Type evaluate(const Type &x)=0
Calculates the selectivity.
static uint32_t id_g
Definition selectivity_base.hpp:30
SelectivityBase()
Constructor.
Definition selectivity_base.hpp:34