| 116 | } |
| 117 | |
| 118 | Service::Ptr Host::GetServiceByShortName(const Value& name) |
| 119 | { |
| 120 | if (name.IsScalar()) { |
| 121 | { |
| 122 | std::unique_lock<std::mutex> lock(m_ServicesMutex); |
| 123 | |
| 124 | auto it = m_Services.find(name); |
| 125 | |
| 126 | if (it != m_Services.end()) |
| 127 | return it->second; |
| 128 | } |
| 129 | |
| 130 | return nullptr; |
| 131 | } else if (name.IsObjectType<Dictionary>()) { |
| 132 | Dictionary::Ptr dict = name; |
| 133 | String short_name; |
| 134 | |
| 135 | return Service::GetByNamePair(dict->Get("host"), dict->Get("service")); |
| 136 | } else { |
| 137 | BOOST_THROW_EXCEPTION(std::invalid_argument("Host/Service name pair is invalid: " + JsonEncode(name))); |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | HostState Host::CalculateState(ServiceState state) |
| 142 | { |
no test coverage detected