SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSBusStop.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // A lane area vehicles can halt at
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
10 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #include <cassert>
32 #include "MSTrigger.h"
33 #include "MSBusStop.h"
35 #include <microsim/MSVehicleType.h>
36 
37 #ifdef CHECK_MEMORY_LEAKS
38 #include <foreign/nvwa/debug_new.h>
39 #endif // CHECK_MEMORY_LEAKS
40 
41 
42 // ===========================================================================
43 // method definitions
44 // ===========================================================================
45 MSBusStop::MSBusStop(const std::string& id,
46  const std::vector<std::string> &lines,
47  MSLane& lane,
48  SUMOReal begPos, SUMOReal endPos)
49  : MSTrigger(id), myLines(lines), myLane(lane),
50  myBegPos(begPos), myEndPos(endPos), myLastFreePos(endPos) {
52 }
53 
54 
56 
57 
58 const MSLane&
60  return myLane;
61 }
62 
63 
66  return myBegPos;
67 }
68 
69 
72  return myEndPos;
73 }
74 
75 
76 void
78  myEndPositions[what] = std::pair<SUMOReal, SUMOReal>(beg, end);
80 }
81 
82 
85  if(myLastFreePos!=myEndPos) {
86  return myLastFreePos - forVehicle.getVehicleType().getMinGap();
87  }
88  return myLastFreePos;
89 }
90 
91 
92 void
94  assert(myEndPositions.find(what) != myEndPositions.end());
95  myEndPositions.erase(myEndPositions.find(what));
97 }
98 
99 
100 void
103  std::map<SUMOVehicle*, std::pair<SUMOReal, SUMOReal> >::iterator i;
104  for (i = myEndPositions.begin(); i != myEndPositions.end(); i++) {
105  if (myLastFreePos > (*i).second.second) {
106  myLastFreePos = (*i).second.second;
107  }
108  }
109 }
110 
111 
112 
113 /****************************************************************************/
114