SUMO - Simulation of Urban MObility
NBCapacity2Lanes.h
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3
// Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials
5
// are made available under the terms of the Eclipse Public License v2.0
6
// which accompanies this distribution, and is available at
7
// http://www.eclipse.org/legal/epl-v20.html
8
// SPDX-License-Identifier: EPL-2.0
9
/****************************************************************************/
16
// A helper class which computes the lane number from given capacity
17
/****************************************************************************/
18
#ifndef NBCapacity2Lanes_h
19
#define NBCapacity2Lanes_h
20
21
22
// ===========================================================================
23
// included modules
24
// ===========================================================================
25
#include <
config.h
>
26
27
28
// ===========================================================================
29
// class definitions
30
// ===========================================================================
40
class
NBCapacity2Lanes
{
41
public
:
46
NBCapacity2Lanes
(
double
divider) :
myDivider
(divider) { }
47
48
50
~NBCapacity2Lanes
() { }
51
52
61
int
get
(
double
capacity)
const
{
62
capacity /=
myDivider
;
63
if
(capacity > (
int
) capacity) {
64
capacity += 1;
65
}
66
// just assure that the number of lanes is not zero
67
if
(capacity == 0) {
68
capacity = 1;
69
}
70
return
(
int
) capacity;
71
}
72
73
private
:
75
double
myDivider
;
76
77
};
78
79
80
#endif
81
82
/****************************************************************************/
83
NBCapacity2Lanes
A helper class which computes the lane number from given capacity.
Definition:
NBCapacity2Lanes.h:40
config.h
NBCapacity2Lanes::~NBCapacity2Lanes
~NBCapacity2Lanes()
Destructor.
Definition:
NBCapacity2Lanes.h:50
NBCapacity2Lanes::myDivider
double myDivider
The norming divider.
Definition:
NBCapacity2Lanes.h:75
NBCapacity2Lanes::NBCapacity2Lanes
NBCapacity2Lanes(double divider)
Donstructor.
Definition:
NBCapacity2Lanes.h:46
src
netbuild
NBCapacity2Lanes.h
Generated on Sun Feb 3 2019 09:17:52 for SUMO - Simulation of Urban MObility by
1.8.13