Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
RODFRouteCont.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// A container for routes
20/****************************************************************************/
21#pragma once
22#include <config.h>
23
24#include <vector>
25#include <map>
27#include "RODFRouteDesc.h"
28
29
30// ===========================================================================
31// class declarations
32// ===========================================================================
33class RODFNet;
34class OutputDevice;
35
36
37// ===========================================================================
38// class definitions
39// ===========================================================================
54public:
57
60
61
73 void addRouteDesc(RODFRouteDesc& desc);
74
75
86
87
96 bool save(std::vector<std::string>& saved,
97 const std::string& prependix, OutputDevice& out);
98
99
103 std::vector<RODFRouteDesc>& get() {
104 return myRoutes;
105 }
106
107
113 void sortByDistance();
114
115
123 void removeIllegal(const std::vector<ROEdgeVector >& illegals);
124
125
126protected:
134 void setID(RODFRouteDesc& desc) const;
135
136
139 public:
141 explicit by_distance_sorter() { }
142
144 int operator()(const RODFRouteDesc& p1, const RODFRouteDesc& p2) {
145 return p1.distance2Last < p2.distance2Last;
146 }
147 };
148
149
152 public:
156 explicit route_finder(const RODFRouteDesc& desc) : myDesc(desc) { }
157
159 bool operator()(const RODFRouteDesc& desc) {
160 return myDesc.edges2Pass == desc.edges2Pass;
161 }
162
163 private:
166 };
167
168protected:
170 std::vector<RODFRouteDesc> myRoutes;
171
173 mutable std::map<std::pair<ROEdge*, ROEdge*>, int> myConnectionOccurrences;
174
175
176};
Static storage of an output device and its base (abstract) implementation.
A DFROUTER-network.
Definition RODFNet.h:42
A class for sorting route descriptions by their length.
int operator()(const RODFRouteDesc &p1, const RODFRouteDesc &p2)
Sorting function; compares RODFRouteDesc::distance2Last.
A class for finding a same route (one that passes the same edges)
route_finder(const RODFRouteDesc &desc)
onstructor
bool operator()(const RODFRouteDesc &desc)
The comparing function; compares passed edges.
const RODFRouteDesc & myDesc
The route description for which a same shall be found.
A container for DFROUTER-routes.
void setID(RODFRouteDesc &desc) const
Computes and sets the id of a route.
void removeIllegal(const std::vector< ROEdgeVector > &illegals)
Removes "illegal" routes.
void addRouteDesc(RODFRouteDesc &desc)
Adds a route to the container.
std::vector< RODFRouteDesc > myRoutes
Stored route descriptions.
~RODFRouteCont()
Destructor.
RODFRouteCont()
Constructor.
bool save(std::vector< std::string > &saved, const std::string &prependix, OutputDevice &out)
Saves routes.
std::vector< RODFRouteDesc > & get()
Returns the container of stored routes.
bool removeRouteDesc(RODFRouteDesc &desc)
Removes the given route description from the container.
std::map< std::pair< ROEdge *, ROEdge * >, int > myConnectionOccurrences
Counts how many routes connecting the key-edges were already stored.
void sortByDistance()
Sorts routes by their distance (length)
A route within the DFROUTER.
double distance2Last
ROEdgeVector edges2Pass
The edges the route is made of.