Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
RouterProvider.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 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// ===========================================================================
35template<class E, class L, class N, class V>
37public:
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 == nullptr ? nullptr : original.myPedRouter->clone())),
51 myInterRouter(static_cast<IntermodalRouter<E, L, N, V>*>(original.myInterRouter == nullptr ? nullptr : original.myInterRouter->clone())),
52 myRailRouter(static_cast<RailwayRouter<E, V>*>(original.myRailRouter == nullptr ? nullptr : original.myRailRouter->clone()))
53 {}
54
55 virtual ~RouterProvider() {
56 delete myVehRouter;
57 delete myPedRouter;
58 delete myInterRouter;
59 delete myRailRouter;
60 }
61
63 return new RouterProvider(*this);
64 }
65
67 if (myRailRouter == nullptr || !isRailway(svc)) {
68 return *myVehRouter;
69 } else {
70 return *myRailRouter;
71 }
72 }
73
77
81
85
86 inline void setBulkMode(const bool mode) const {
87 myVehRouter->setBulkMode(mode);
88 if (myPedRouter != nullptr) {
89 myPedRouter->setBulkMode(mode);
90 }
91 if (myInterRouter != nullptr) {
92 myInterRouter->setBulkMode(mode);
93 }
94 if (myRailRouter != nullptr) {
95 myRailRouter->setBulkMode(mode);
96 }
97 }
98
99
100private:
105
106
107private:
110
111};
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permissions is a railway edge.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
virtual ~RouterProvider()
SUMOAbstractRouter< E, V > *const myVehRouter
PedestrianRouter< E, L, N, V > *const myPedRouter
RailwayRouter< E, V > *const myRailRouter
PedestrianRouter< E, L, N, V > & getPedestrianRouter() const
RouterProvider(SUMOAbstractRouter< E, V > *vehRouter, PedestrianRouter< E, L, N, V > *pedRouter, IntermodalRouter< E, L, N, V > *interRouter, RailwayRouter< E, V > *railRouter)
SUMOAbstractRouter< E, V > & getVehicleRouter(SUMOVehicleClass svc) const
RouterProvider & operator=(const RouterProvider &src)
Invalidated assignment operator.
RouterProvider(const RouterProvider &original)
IntermodalRouter< E, L, N, V > *const myInterRouter
RailwayRouter< E, V > & getRailwayRouter() const
void setBulkMode(const bool mode) const
RouterProvider * clone()
IntermodalRouter< E, L, N, V > & getIntermodalRouter() const