6 #include <unordered_map>
28 if (min_value > max_value) {
29 throw std::invalid_argument(
"Factor range minimum must not be greater than maximum.");
87 const std::string &
name() const noexcept;
91 short level() const noexcept;
95 const core::Identifier &
key() const noexcept;
99 const core::Identifier &
entity_key() const noexcept;
120 core::Identifier name_key_;
124 bool dynamic_factor_;
143 const std::vector<MappingEntry> &
entries() const noexcept;
151 std::
size_t size() const noexcept;
198 std::vector<MappingEntry> mapping_;
Defines the hierarchical model mapping data type.
Definition: mapping.h:128
IteratorType end() noexcept
Gets an iterator to the element following the last mapping.
Definition: mapping.h:179
ConstIteratorType cend() const noexcept
Gets a read-only iterator to the element following the last mapping.
Definition: mapping.h:195
std::vector< MappingEntry >::iterator IteratorType
Hierarchical mappings iterator.
Definition: mapping.h:131
ConstIteratorType end() const noexcept
Gets a read-only iterator to the element following the last mapping.
Definition: mapping.h:187
std::vector< MappingEntry > entries_without_dynamic() const noexcept
Gets the collection of mapping entries without the dynamic factor.
Definition: mapping.cpp:71
std::vector< MappingEntry >::const_iterator ConstIteratorType
read-only hierarchical mappings iterator
Definition: mapping.h:133
IteratorType begin() noexcept
Gets an iterator to the beginning of the mappings.
Definition: mapping.h:175
const std::vector< MappingEntry > & entries() const noexcept
Gets the collection of mapping entries.
Definition: mapping.cpp:69
std::vector< MappingEntry > at_level_without_dynamic(int level) const noexcept
Gets the mapping entries at a given hierarchical level without the dynamic factor.
Definition: mapping.cpp:108
int max_level() const noexcept
Gets the maximum hierarchical level.
Definition: mapping.cpp:81
std::size_t size() const noexcept
Gets the size of the mappings collection.
Definition: mapping.cpp:79
ConstIteratorType cbegin() const noexcept
Gets an read-only iterator to the beginning of the mappings.
Definition: mapping.h:191
ConstIteratorType begin() const noexcept
Gets an read-only iterator to the beginning of the mappings.
Definition: mapping.h:183
std::vector< MappingEntry > at_level(int level) const noexcept
Gets the mapping entries at a given hierarchical level.
Definition: mapping.cpp:100
HierarchicalMapping()=delete
MappingEntry at(const core::Identifier &key) const
Gets a mapping entry by identifier.
Definition: mapping.cpp:89
Defines risk factor mapping entry data type.
Definition: mapping.h:47
bool is_entity() const noexcept
Determine whether this factor has an associated Person property, e.g. age.
Definition: mapping.cpp:37
const core::Identifier & key() const noexcept
Gets the factor unique identification.
Definition: mapping.cpp:41
double get_bounded_value(const double &value) const noexcept
Adjusts a value to the factor range, if provided.
Definition: mapping.cpp:45
short level() const noexcept
Gets the factor hierarchical level.
Definition: mapping.cpp:31
const std::string & name() const noexcept
Gets the factor name.
Definition: mapping.cpp:29
const core::Identifier & entity_key() const noexcept
Gets the factor's associated Person property identifier.
Definition: mapping.cpp:33
const FactorRange & range() const noexcept
Gets the factor allowed values range.
Definition: mapping.cpp:43
bool is_dynamic_factor() const noexcept
Determine whether this instance is a dynamic factor.
Definition: mapping.cpp:39
Top-level namespace for Health-GPS C++ API.
Definition: analysis_definition.h:8
const core::Identifier InterceptKey
The constant in the regression model presentation identifier.
Definition: mapping.h:12
Global namespace.
Definition: jsonparser.h:88
Defines the risk factor allowed range data type.
Definition: mapping.h:18
bool empty
Gets a value indicating whether the range is empty, no limits.
Definition: mapping.h:34
FactorRange(double min_value, double max_value)
Initialises a new instance of the FactorRange structure.
Definition: mapping.h:26
double minimum
The range minimum value.
Definition: mapping.h:37
double maximum
The range maximum value.
Definition: mapping.h:40
FactorRange()=default
Initialises a new instance of the FactorRange structure.
Entity unique identifier data type.
Definition: identifier.h:17