/****************************************************************************/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 NBCapacity2Lanes.h14/// @author Daniel Krajzewicz15/// @author Sascha Krieg16/// @date Fri, 19 Jul 200217///18// A helper class which computes the lane number from given capacity19/****************************************************************************/20#pragma once21#include <config.h>222324// ===========================================================================25// class definitions26// ===========================================================================27/**28* @class NBCapacity2Lanes29* @brief A helper class which computes the lane number from given capacity30*31* A helper class for the computation of the number of lanes an edge has32* in dependence to this edge's capacity. The computation is done by the33* (trivial) assumption, the number of lanes increases linear with the34* number of lanes.35*/36class NBCapacity2Lanes {37public:38/** @brief Donstructor39*40* @param[in] divider Value for the norming divider41*/42NBCapacity2Lanes(double divider) : myDivider(divider) { }434445/// @brief Destructor46~NBCapacity2Lanes() { }474849/** @brief Returns the number of lanes computed from the given capacity50*51* Returns the estimated number of lanes by returning the given capacity52* divided by the norming divider given in the constructor.53*54* @param[in] capacity The capacity to convert55* @return The capacity converted to the number of lanes56*/57int get(double capacity) const {58capacity /= myDivider;59if (capacity > (int) capacity) {60capacity += 1;61}62// just assure that the number of lanes is not zero63if (capacity == 0) {64capacity = 1;65}66return (int) capacity;67}6869private:70/// @brief The norming divider71double myDivider;7273};747576