File indexing completed on 2025-08-06 08:17:35
0001 #include "CentralityInfov1.h"
0002
0003 #include <limits>
0004
0005 void CentralityInfov1::identify(std::ostream &os) const
0006 {
0007 os << "CentralityInfov1: " << std::endl;
0008 os << " Centile: " << (has_centile(CentralityInfo::PROP::mbd_NS) ? get_centile(CentralityInfo::PROP::mbd_NS) : -999.99) << std::endl;
0009
0010 return;
0011 }
0012
0013 void CentralityInfov1::Reset()
0014 {
0015 _quantity_map.clear();
0016 _centile_map.clear();
0017 }
0018
0019 bool CentralityInfov1::has_quantity(const PROP prop_id) const
0020 {
0021 return _quantity_map.find(prop_id) != _quantity_map.end();
0022 }
0023
0024 void CentralityInfov1::set_quantity(const PROP prop_id, float value)
0025 {
0026 _quantity_map[prop_id] = value;
0027 }
0028
0029 float CentralityInfov1::get_quantity(const PROP prop_id) const
0030 {
0031 if (!has_quantity(prop_id))
0032 {
0033 return std::numeric_limits<float>::quiet_NaN();
0034 }
0035
0036 return _quantity_map.at(prop_id);
0037 }
0038
0039 bool CentralityInfov1::has_centile(const PROP prop_id) const
0040 {
0041 return _centile_map.find(prop_id) != _centile_map.end();
0042 }
0043
0044 void CentralityInfov1::set_centile(const PROP prop_id, float value)
0045 {
0046 _centile_map[prop_id] = value;
0047 }
0048
0049 float CentralityInfov1::get_centile(const PROP prop_id) const
0050 {
0051 if (!has_centile(prop_id))
0052 {
0053 return std::numeric_limits<float>::quiet_NaN();
0054 }
0055
0056 return _centile_map.at(prop_id);
0057 }
0058
0059 void CentralityInfov1::CopyTo(CentralityInfo *info)
0060 {
0061 for (auto const &it : _quantity_map)
0062 {
0063 info->set_quantity((CentralityInfo::PROP)(it.first), it.second);
0064 }
0065 for (auto const &it : _centile_map)
0066 {
0067 info->set_centile((CentralityInfo::PROP)(it.first), it.second);
0068 }
0069 }