SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSBusStop.h
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-sim.org/
10 // Copyright (C) 2001-2013 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 #ifndef MSBusStop_h
21 #define MSBusStop_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 #include <vector>
34 #include <algorithm>
35 #include <map>
36 #include <string>
37 #include <utils/common/Named.h>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class MSLane;
44 class SUMOVehicle;
45 class MSPerson;
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
63 class MSBusStop : public Named {
64 public:
74  MSBusStop(const std::string& id,
75  const std::vector<std::string>& lines, MSLane& lane,
76  SUMOReal begPos, SUMOReal endPos);
77 
78 
80  virtual ~MSBusStop();
81 
82 
87  const MSLane& getLane() const;
88 
89 
95 
96 
102 
103 
115  void enter(SUMOVehicle* what, SUMOReal beg, SUMOReal end);
116 
117 
127  void leaveFrom(SUMOVehicle* what);
128 
129 
134  SUMOReal getLastFreePos(const SUMOVehicle& forVehicle) const;
135 
136 
139  unsigned int getPersonNumber() const {
140  return static_cast<unsigned int>(myWaitingPersons.size());
141  }
142 
143  void addPerson(MSPerson* p) {
144  myWaitingPersons.push_back(p);
145  }
146 
148  std::vector<MSPerson*>::iterator i = std::find(myWaitingPersons.begin(), myWaitingPersons.end(), p);
149  if (i != myWaitingPersons.end()) {
150  myWaitingPersons.erase(i);
151  }
152  }
153 
154 protected:
161  void computeLastFreePos();
162 
163 
164 protected:
166  std::vector<std::string> myLines;
167 
169  std::map<SUMOVehicle*, std::pair<SUMOReal, SUMOReal> > myEndPositions;
170 
173 
176 
179 
182 
184  std::vector<MSPerson*> myWaitingPersons;
185 
186 
187 private:
189  MSBusStop(const MSBusStop&);
190 
192  MSBusStop& operator=(const MSBusStop&);
193 
194 
195 };
196 
197 
198 #endif
199 
200 /****************************************************************************/
201