FIMS  v0.9.3
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
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 this->register_self(this->id);
38 }
39
40 virtual ~SelectivityBase() {}
41
47 virtual const Type evaluate(const Type& x) = 0;
48
55 virtual const Type evaluate(const Type& x, size_t pos) = 0;
56};
57
58// default id of the singleton selectivity class
59template <typename Type>
61
62} // namespace fims_popdy
63
64#endif /* POPULATION_DYNAMICS_SELECTIVITY_BASE_HPP */
Definition of the FIMSObject structure.
The population dynamics of FIMS.
Definition catch_at_age.hpp:41
void clear_internal()
Clears the internal objects.
Definition rcpp_interface.hpp:236
void register_self(const uint32_t id)
Registers a FIMSObject instance with the memory tracker.
Definition model_object.hpp:35
FIMSObject struct that defines member types and returns the unique id.
Definition model_object.hpp:55
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