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

vehicle_model.hpp « routing - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2a7303c8af9d7c5bbb3cf860eab96e2fb79a38c2 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include "../std/unordered_map.hpp"
#include "../std/utility.hpp"
#include "../std/vector.hpp"
#include "../std/stdint.hpp"

class Classificator;
class FeatureType;

namespace feature { class TypesHolder; }

namespace routing
{

class IVehicleModel
{
public:
  virtual ~IVehicleModel() {}

  virtual double GetSpeed(FeatureType const & f) const = 0;
  virtual double GetMaxSpeed() const = 0;
  virtual bool IsOneWay(FeatureType const & f) const = 0;
};

class VehicleModel : public IVehicleModel
{
public:
  struct SpeedForType
  {
    char const * m_types[2];
    double m_speed;
  };

  VehicleModel(Classificator const & c, vector<SpeedForType> const & speedLimits);

  virtual double GetSpeed(FeatureType const & f) const;
  virtual double GetMaxSpeed() const { return m_maxSpeed; }
  virtual bool IsOneWay(FeatureType const & f) const;

  double GetSpeed(feature::TypesHolder const & types) const;
  bool IsOneWay(feature::TypesHolder const & types) const;

private:
  double m_maxSpeed;
  typedef unordered_map<uint32_t, SpeedForType> TypesT;
  TypesT m_types;
  uint32_t m_onewayType;
};

class CarModel : public VehicleModel
{
public:
  CarModel();
};

}