| 292 | } |
| 293 | |
| 294 | void EventsRouter::Unsubscribe(const std::set<EventType>& types, const EventsInbox::Ptr& inbox) |
| 295 | { |
| 296 | const auto& filter (inbox->GetFilter()); |
| 297 | std::unique_lock<std::mutex> lock (m_Mutex); |
| 298 | |
| 299 | for (auto type : types) { |
| 300 | auto perType (m_Subscribers.find(type)); |
| 301 | |
| 302 | if (perType != m_Subscribers.end()) { |
| 303 | auto perFilter (perType->second.find(filter)); |
| 304 | |
| 305 | if (perFilter != perType->second.end()) { |
| 306 | perFilter->second.erase(inbox); |
| 307 | |
| 308 | if (perFilter->second.empty()) { |
| 309 | perType->second.erase(perFilter); |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | if (perType->second.empty()) { |
| 314 | m_Subscribers.erase(perType); |
| 315 | } |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | EventsFilter EventsRouter::GetInboxes(EventType type) |
| 321 | { |
no test coverage detected