Eclipse SUMO - Simulation of Urban MObility
RouterProvider.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // The RouterProvider provides car, pedestrian and intermodal routing in one object
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
24 #include "IntermodalRouter.h"
25 #include "RailwayRouter.h"
26 
27 
28 // ===========================================================================
29 // class definitions
30 // ===========================================================================
35 template<class E, class L, class N, class V>
37 public:
40  IntermodalRouter<E, L, N, V>* interRouter,
41  RailwayRouter<E, V>* railRouter) :
42  myVehRouter(vehRouter),
43  myPedRouter(pedRouter),
44  myInterRouter(interRouter),
45  myRailRouter(railRouter)
46  {}
47 
48  RouterProvider(const RouterProvider& original) :
49  myVehRouter(original.myVehRouter->clone()),
50  myPedRouter(static_cast<PedestrianRouter<E, L, N, V>*>(original.myPedRouter == 0 ? 0 : original.myPedRouter->clone())),
51  myInterRouter(static_cast<IntermodalRouter<E, L, N, V>*>(original.myInterRouter == 0 ? 0 : original.myInterRouter->clone())),
52  myRailRouter(static_cast<RailwayRouter<E, V>*>(original.myRailRouter == 0 ? 0 : original.myRailRouter->clone()))
53  {}
54 
56  return new RouterProvider(*this);
57  }
58 
60  if (myRailRouter == nullptr || !isRailway(svc)) {
61  return *myVehRouter;
62  } else {
63  return *myRailRouter;
64  }
65  }
66 
68  return *myPedRouter;
69  }
70 
72  return *myInterRouter;
73  }
74 
76  return *myRailRouter;
77  }
78 
79  virtual ~RouterProvider() {
80  delete myVehRouter;
81  delete myPedRouter;
82  delete myInterRouter;
83  delete myRailRouter;
84  }
85 
86 
87 private:
92 
93 
94 private:
97 
98 };
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
virtual ~RouterProvider()
RouterProvider * clone()
SUMOAbstractRouter< E, V > *const myVehRouter
PedestrianRouter< E, L, N, V > *const myPedRouter
RouterProvider & operator=(const RouterProvider &src)
Invalidated assignment operator.
RailwayRouter< E, V > *const myRailRouter
PedestrianRouter< E, L, N, V > & getPedestrianRouter() const
SUMOAbstractRouter< E, V > & getVehicleRouter(SUMOVehicleClass svc) const
RailwayRouter< E, V > & getRailwayRouter() const
RouterProvider(SUMOAbstractRouter< E, V > *vehRouter, PedestrianRouter< E, L, N, V > *pedRouter, IntermodalRouter< E, L, N, V > *interRouter, RailwayRouter< E, V > *railRouter)
RouterProvider(const RouterProvider &original)
IntermodalRouter< E, L, N, V > *const myInterRouter
IntermodalRouter< E, L, N, V > & getIntermodalRouter() const