Welcome to mirror list, hosted at ThFree Co, Russian Federation.

traffic_cache.hpp « traffic - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2e960e770019137c0db3a87c4d64873c00bccb95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once

#include "traffic/traffic_info.hpp"

#include "indexer/mwm_set.hpp"

#include <map>
#include <memory>
#include <mutex>

namespace traffic
{
using AllMwmTrafficInfo = std::map<MwmSet::MwmId, std::shared_ptr<const traffic::TrafficInfo::Coloring>>;

class TrafficCache
{
public:
  TrafficCache() : m_trafficColoring() {}
  virtual ~TrafficCache() = default;

  virtual void CopyTraffic(AllMwmTrafficInfo & trafficColoring) const;

protected:
  void Set(MwmSet::MwmId const & mwmId, std::shared_ptr<TrafficInfo::Coloring const> coloring);
  void Remove(MwmSet::MwmId const & mwmId);
  void Clear();

private:
  std::mutex m_mutex;
  AllMwmTrafficInfo m_trafficColoring;
};
}  // namespace traffic