mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-02 11:03:44 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
57
routing/traffic_stash.hpp
Normal file
57
routing/traffic_stash.hpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#include "routing/segment.hpp"
|
||||
|
||||
#include "traffic/traffic_cache.hpp"
|
||||
#include "traffic/traffic_info.hpp"
|
||||
|
||||
#include "routing_common/num_mwm_id.hpp"
|
||||
|
||||
#include "indexer/mwm_set.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
namespace routing
|
||||
{
|
||||
class TrafficStash final
|
||||
{
|
||||
public:
|
||||
class Guard final
|
||||
{
|
||||
public:
|
||||
explicit Guard(std::shared_ptr<TrafficStash> stash) : m_stash(std::move(stash))
|
||||
{
|
||||
if (m_stash)
|
||||
m_stash->CopyTraffic();
|
||||
}
|
||||
|
||||
~Guard()
|
||||
{
|
||||
if (m_stash)
|
||||
m_stash->Clear();
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<TrafficStash> m_stash;
|
||||
};
|
||||
|
||||
TrafficStash(traffic::TrafficCache const & source, std::shared_ptr<NumMwmIds> numMwmIds);
|
||||
|
||||
traffic::SpeedGroup GetSpeedGroup(Segment const & segment) const;
|
||||
void SetColoring(NumMwmId numMwmId, std::shared_ptr<const traffic::TrafficInfo::Coloring> coloring);
|
||||
bool Has(NumMwmId numMwmId) const;
|
||||
|
||||
private:
|
||||
void CopyTraffic();
|
||||
|
||||
void Clear() { m_mwmToTraffic.clear(); }
|
||||
|
||||
traffic::TrafficCache const & m_source;
|
||||
std::shared_ptr<NumMwmIds> m_numMwmIds;
|
||||
std::unordered_map<NumMwmId, std::shared_ptr<const traffic::TrafficInfo::Coloring>> m_mwmToTraffic;
|
||||
};
|
||||
} // namespace routing
|
||||
Reference in New Issue
Block a user