17 template <
typename T>
WeightModel(T &&value) : pimpl_{new Model<T>(
std::forward<T>(value))} {}
27 this->pimpl_ = other.pimpl_->clone();
48 return pimpl_->classify_weight(person);
59 return pimpl_->adjust_risk_factor_value(entity, risk_factor_key, value);
65 virtual std::unique_ptr<Concept> clone()
const = 0;
69 const core::Identifier &risk_factor_key,
70 double value) const = 0;
73 template <typename T> struct Model : Concept {
74 Model(T &&value) : object_{
std::forward<T>(value)} {}
76 std::unique_ptr<Concept> clone()
const override {
return std::make_unique<Model>(*
this); }
79 return object_.child_cutoff_age();
83 return object_.classify_weight(entity);
87 const core::Identifier &risk_factor_key,
88 double value)
const override {
89 return object_.adjust_risk_factor_value(entity, risk_factor_key, value);
95 std::unique_ptr<Concept> pimpl_;
Weight classification model polymorphic wrapper class.
Definition: weight_model.h:12
double adjust_risk_factor_value(const Person &entity, const core::Identifier &risk_factor_key, double value) const
Adjust a Person risk factor value.
Definition: weight_model.h:57
WeightModel & operator=(const WeightModel &other)
Replaces the WeightModel with a copy of the other's contents.
Definition: weight_model.h:26
WeightModel(WeightModel &&other)=default
Constructs the WeightModel with the contents of other using move semantics.
WeightModel & operator=(WeightModel &&other)=default
Replaces the WeightModel contents with the other using move semantics.
unsigned int child_cutoff_age() const noexcept
Gets the children cut-off age (before adult)
Definition: weight_model.h:42
WeightModel(const WeightModel &other)
Constructs the WeightModel with the copy of the other's contents.
Definition: weight_model.h:21
WeightModel(T &&value)
Initialises a new instance of the WeightModel class.
Definition: weight_model.h:17
WeightCategory classify_weight(const Person &person) const
Classify a person weight according with the predefined categories.
Definition: weight_model.h:47
Top-level namespace for Health-GPS C++ API.
Definition: analysis_definition.h:8
std::string weight_category_to_string(WeightCategory value)
Converts a WeightCategory to a string representation.
Definition: weight_model.cpp:4
WeightCategory
Enumerates the Person weight categories.
Definition: weight_category.h:7
Global namespace.
Definition: jsonparser.h:88
Defines a virtual population person data type.
Definition: person.h:40
Entity unique identifier data type.
Definition: identifier.h:17