Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
ROHelper.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// Some helping methods for router
20/****************************************************************************/
21#pragma once
22#include <config.h>
23
24#include <functional>
25#include <vector>
26#include "ROEdge.h"
27#include "ROVehicle.h"
28
29
30// ===========================================================================
31// class definitions
32// ===========================================================================
40class ROVehicleByDepartureComperator : public std::less<ROVehicle*> {
41public:
44
47
59 bool operator()(ROVehicle* veh1, ROVehicle* veh2) const {
60 if (veh1->getDepart() == veh2->getDepart()) {
61 return veh1->getID() > veh2->getID();
62 }
63 return veh1->getDepart() > veh2->getDepart();
64 }
65};
66
67
72namespace ROHelper {
77void recheckForLoops(ConstROEdgeVector& edges, const ConstROEdgeVector& mandatory);
78
79bool noMandatory(const ConstROEdgeVector& mandatory,
80 ConstROEdgeVector::const_iterator start,
81 ConstROEdgeVector::const_iterator end);
82}
std::vector< const ROEdge * > ConstROEdgeVector
Definition ROEdge.h:54
SUMOTime getDepart() const
Returns the time the vehicle starts at, -1 for triggered vehicles.
Definition RORoutable.h:100
const std::string & getID() const
Returns the id of the routable.
Definition RORoutable.h:91
A function for sorting vehicles by their departure time.
Definition ROHelper.h:40
ROVehicleByDepartureComperator()
Constructor.
Definition ROHelper.h:43
~ROVehicleByDepartureComperator()
Destructor.
Definition ROHelper.h:46
bool operator()(ROVehicle *veh1, ROVehicle *veh2) const
Comparing operator.
Definition ROHelper.h:59
A vehicle as used by router.
Definition ROVehicle.h:50
Some helping methods for router.
Definition ROHelper.cpp:35
void recheckForLoops(ConstROEdgeVector &edges, const ConstROEdgeVector &mandatory)
Checks whether the given edge list contains loops and removes them.
Definition ROHelper.cpp:37
bool noMandatory(const ConstROEdgeVector &mandatory, ConstROEdgeVector::const_iterator start, ConstROEdgeVector::const_iterator end)
Definition ROHelper.cpp:122