| 71 | } |
| 72 | |
| 73 | void HoUnitSpecification::AddUnit(HoUnit unit) { |
| 74 | const std::string& key = unit.Identity() ; |
| 75 | if (key.empty()) { |
| 76 | MDF_ERROR() << "A unit must have an identity."; |
| 77 | return; |
| 78 | } |
| 79 | |
| 80 | if (const auto itr = unit_list_.find(key); |
| 81 | itr != unit_list_.cend() ) { |
| 82 | MDF_ERROR() << "The unit is already defined. Short Name: " << key; |
| 83 | return; |
| 84 | } |
| 85 | unit_list_.emplace(key,std::move(unit)); |
| 86 | } |
| 87 | |
| 88 | const HoUnitList& HoUnitSpecification::Units() const { |
| 89 | return unit_list_; |