/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2004-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 ROJTREdge.h14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @author Yun-Pang Floetteroed17/// @date Tue, 20 Jan 200418///19// An edge the jtr-router may route through20/****************************************************************************/21#pragma once22#include <config.h>2324#include <string>25#include <map>26#include <vector>27#include <utils/common/ValueTimeLine.h>28#include <router/ROEdge.h>293031// ===========================================================================32// class declarations33// ===========================================================================34class ROLane;353637// ===========================================================================38// class definitions39// ===========================================================================40/**41* @class ROJTREdge42* @brief An edge the jtr-router may route through43*44* A router edge extended by the definition about the probability a45* vehicle chooses a certain following edge over time.46*/47class ROJTREdge : public ROEdge {48public:49/** @brief Constructor50*51* @param[in] id The id of the edge52* @param[in] from The node the edge begins at53* @param[in] to The node the edge ends at54* @param[in] index The numeric id of the edge55*/56ROJTREdge(const std::string& id, RONode* from, RONode* to, int index, const int priority, const std::string& type);575859/// @brief Destructor60~ROJTREdge();616263/** @brief Adds information about a connected edge64*65* Makes this edge know the given following edge. Calls ROEdge::addFollower.66*67* Additionally it generates the entry for the given following edge68* in myFollowingDefs.69*70* @param[in] s The following edge71* @see ROEdge::addFollower72*/73void addSuccessor(ROEdge* s, ROEdge* via = nullptr, std::string dir = "");747576/** @brief adds the information about the percentage of using a certain follower77*78* @param[in] follower The following edge79* @param[in] begTime Time begin (in seconds) for which this probability is valid80* @param[in] endTime Time end (in seconds) for which this probability is valid81* @param[in] probability The probability to use the given follower82*/83void addFollowerProbability(ROJTREdge* follower,84double begTime, double endTime, double probability);858687/** @brief Returns the next edge to use88* @param[in] veh The vehicle to choose the next edge for89* @param[in] time The time at which the next edge shall be entered (in seconds)90* @param[in] avoid The set of edges to avoid91* @return The chosen edge92*/93ROJTREdge* chooseNext(const ROVehicle* const veh, double time, const std::set<const ROEdge*>& avoid) const;949596/** @brief Sets the turning definition defaults97* @param[in] def The turning percentage defaults98*/99void setTurnDefaults(const std::vector<double>& defs);100101/// @brief register source flow on this edge102int getSourceFlow() const {103return mySourceFlows;104}105106/// @brief register flow on this edge107void changeSourceFlow(int value) {108mySourceFlows += value;109}110111private:112/// @brief Definition of a map that stores the probabilities of using a certain follower over time113typedef std::map<ROJTREdge*, ValueTimeLine<double>*, ComparatorIdLess> FollowerUsageCont;114115/// @brief Storage for the probabilities of using a certain follower over time116FollowerUsageCont myFollowingDefs;117118/// @brief The defaults for turnings119std::vector<double> myParsedTurnings;120121/// @brief the flows departing from this edge in the given time122//ValueTimeLine<int> mySourceFlows;123int mySourceFlows;124125private:126/// @brief invalidated copy constructor127ROJTREdge(const ROJTREdge& src);128129/// @brief invalidated assignment operator130ROJTREdge& operator=(const ROJTREdge& src);131132133};134135136