/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file ROHelper.h14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @date Sept 200217///18// Some helping methods for router19/****************************************************************************/20#pragma once21#include <config.h>2223#include <functional>24#include <vector>25#include "ROEdge.h"26#include "ROVehicle.h"272829// ===========================================================================30// class definitions31// ===========================================================================32/**33* @class ROVehicleByDepartureComperator34* @brief A function for sorting vehicles by their departure time35*36* In the case two vehicles have the same departure time, they are sorted37* lexically.38*/39class ROVehicleByDepartureComperator : public std::less<ROVehicle*> {40public:41/// @brief Constructor42explicit ROVehicleByDepartureComperator() { }4344/// @brief Destructor45~ROVehicleByDepartureComperator() { }4647/** @brief Comparing operator48*49* Returns whether the first vehicles wants to leave later than the second.50* If both vehicles have the same departure time, a lexical comparison is51* done.52*53* @param[i] veh1 The first vehicle to compare54* @param[i] veh2 The second vehicle to compare55* @return Whether the first vehicle departs later than the second56* @todo Check whether both vehicles can be const57*/58bool operator()(ROVehicle* veh1, ROVehicle* veh2) const {59if (veh1->getDepart() == veh2->getDepart()) {60return veh1->getID() > veh2->getID();61}62return veh1->getDepart() > veh2->getDepart();63}64};656667/**68* @namespace ROHelper69* @brief Some helping methods for router70*/71namespace ROHelper {72/** @brief Checks whether the given edge list contains loops and removes them73*74* @param[in] edges The list of edges to remove loops from75*/76void recheckForLoops(ConstROEdgeVector& edges, const ConstROEdgeVector& mandatory);7778bool noMandatory(const ConstROEdgeVector& mandatory,79ConstROEdgeVector::const_iterator start,80ConstROEdgeVector::const_iterator end);81}828384