SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUIInternalLane.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // Lane within junctions, derived from the normal lane
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
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 <string>
34 #include <utility>
36 #include <utils/geom/Position.h>
37 #include <microsim/MSLane.h>
40 #include <microsim/MSNet.h>
41 #include "GUINet.h"
42 #include "GUIVehicle.h"
43 #include "GUILaneWrapper.h"
44 #include "GUIInternalLane.h"
45 
46 #ifdef CHECK_MEMORY_LEAKS
47 #include <foreign/nvwa/debug_new.h>
48 #endif // CHECK_MEMORY_LEAKS
49 
50 
51 // ===========================================================================
52 // method definitions
53 // ===========================================================================
54 GUIInternalLane::GUIInternalLane(const std::string& id,
55  SUMOReal maxSpeed, SUMOReal length,
56  MSEdge* const edge, unsigned int numericalID,
57  const PositionVector& shape, SUMOReal width,
58  SVCPermissions permissions) :
59  MSInternalLane(id, maxSpeed, length, edge, numericalID, shape, width, permissions) {}
60 
61 
63  // just to quit cleanly on a failure
64  if (myLock.locked()) {
65  myLock.unlock();
66  }
67 }
68 
69 
70 // ------ Vehicle insertion ------
71 void
73  const MSLane::VehCont::iterator& at,
74  MSMoveReminder::Notification notification) {
75  myLock.lock();
76  try {
77  MSInternalLane::incorporateVehicle(veh, pos, speed, at, notification);
78  myLock.unlock();
79  } catch (ProcessError&) {
80  myLock.unlock();
81  throw;
82  }
83 }
84 
85 
86 // ------ Access to vehicles ------
87 const MSLane::VehCont&
89  myLock.lock();
90  return myVehicles;
91 }
92 
93 
94 void
96  myLock.unlock();
97 }
98 
99 
100 bool
102  myLock.lock();
103  try {
104  bool ret = MSInternalLane::moveCritical(t);
105  myLock.unlock();
106  return ret;
107  } catch (ProcessError&) {
108  myLock.unlock();
109  throw;
110  }
111 }
112 
113 
114 bool
115 GUIInternalLane::setCritical(SUMOTime t, std::vector<MSLane*> &into) {
116  myLock.lock();
117  try {
118  bool ret = MSInternalLane::setCritical(t, into);
119  myLock.unlock();
120  return ret;
121  } catch (ProcessError&) {
122  myLock.unlock();
123  throw;
124  }
125 }
126 
127 
128 MSVehicle*
130  myLock.lock();
131  try {
132  MSVehicle* ret = MSLane::removeVehicle(remVehicle);
133  myLock.unlock();
134  return ret;
135  } catch (ProcessError&) {
136  myLock.unlock();
137  throw;
138  }
139 }
140 
141 
142 void
144  myLock.lock();
145  try {
147  myLock.unlock();
148  } catch (ProcessError&) {
149  myLock.unlock();
150  throw;
151  }
152 }
153 
154 
155 bool
157  myLock.lock();
158  try {
159  bool ret = MSLane::integrateNewVehicle(t);
160  myLock.unlock();
161  return ret;
162  } catch (ProcessError&) {
163  myLock.unlock();
164  throw;
165  }
166 }
167 
168 
171  return new GUILaneWrapper(*this, myShape, index);
172 }
173 
174 
175 void
177  myLock.lock();
178  try {
179  MSLane::detectCollisions(timestep);
180  myLock.unlock();
181  } catch (ProcessError&) {
182  myLock.unlock();
183  throw;
184  }
185 }
186 
187 
188 
189 /****************************************************************************/
190