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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // A helper class which computes the lane number from given capacity
19 /****************************************************************************/
20 #ifndef NBCapacity2Lanes_h
21 #define NBCapacity2Lanes_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
47 public:
52  NBCapacity2Lanes(double divider) : myDivider(divider) { }
53 
54 
57 
58 
67  int get(double capacity) const {
68  capacity /= myDivider;
69  if (capacity > (int) capacity) {
70  capacity += 1;
71  }
72  // just assure that the number of lanes is not zero
73  if (capacity == 0) {
74  capacity = 1;
75  }
76  return (int) capacity;
77  }
78 
79 private:
81  double myDivider;
82 
83 };
84 
85 
86 #endif
87 
88 /****************************************************************************/
89 
A helper class which computes the lane number from given capacity.
~NBCapacity2Lanes()
Destructor.
double myDivider
The norming divider.
NBCapacity2Lanes(double divider)
Donstructor.