| 335 | |
| 336 | |
| 337 | bool TopicConfig::IsValidQueue(const int queue_id, const int pub_id, const int sub_id) const { |
| 338 | auto &&f = [&](const int arg_pub_id)->bool { |
| 339 | if (-1 != sub_id) { |
| 340 | auto &&it = impl_->pub_id2sub_ids.find(arg_pub_id); |
| 341 | if (impl_->pub_id2sub_ids.end() == it) return false; |
| 342 | auto &&sub_ids = it->second; |
| 343 | auto &&it1 = sub_ids.find(sub_id); |
| 344 | if (sub_ids.end() == it1) return false; |
| 345 | } |
| 346 | |
| 347 | { |
| 348 | auto &&it = impl_->pub_id2queue_info_ids.find(arg_pub_id); |
| 349 | if (impl_->pub_id2queue_info_ids.end() == it) return false; |
| 350 | auto &&queue_info_ids = it->second; |
| 351 | for (auto &&queue_info_id : queue_info_ids) { |
| 352 | auto &&it1 = impl_->queue_info_id2ranges.find(queue_info_id); |
| 353 | if (impl_->queue_info_id2ranges.end() == it1) return false; |
| 354 | auto &&ranges = it1->second; |
| 355 | for (auto &&range : ranges) { |
| 356 | if (range.first <= queue_id && queue_id <= range.second) { |
| 357 | return true; |
| 358 | } |
| 359 | } |
| 360 | } |
| 361 | } |
| 362 | return false; |
| 363 | }; |
| 364 | |
| 365 | if (-1 != pub_id) { |
| 366 | return f(pub_id); |
| 367 | } else { |
| 368 | for (auto &&kv : impl_->pub_id2pub) { |
| 369 | if (f(kv.first)) return true; |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | return false; |
| 374 | } |
| 375 | |
| 376 | comm::RetCode TopicConfig::GetQueuesByQueueInfoID(const int queue_info_id, set<int> &queues) const { |
| 377 | queues.clear(); |
no outgoing calls