1. C++ / Говнокод #26054

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    template<typename T> Histogram<T>& histogram (std::string const& name) {
        std::lock_guard<std::mutex> guard(_lock);
        auto const it = _registry.find(name);
        if (it == _registry.end()) {
          LOG_TOPIC("32d85", ERR, Logger::STATISTICS) << "No histogram booked as " << name;
          TRI_ASSERT(false);
          throw std::exception();
        } 
        std::shared_ptr<Histogram<T>> h = nullptr;
        try {
          h = std::dynamic_pointer_cast<Histogram<T>>(*it->second);
          if (h == nullptr) {
            LOG_TOPIC("d2358", ERR, Logger::STATISTICS) << "Failed to retrieve histogram " << name;
          }
        } catch (std::exception const& e) {
          LOG_TOPIC("32d75", ERR, Logger::STATISTICS)
            << "Failed to retrieve histogram " << name << ": " << e.what();
        }
        if (h == nullptr) {
          TRI_ASSERT(false);
        }
    
        return *h;
      };

    Запостил: gnusmas, 27 Ноября 2019

    Комментарии (1) RSS

    Добавить комментарий