SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
MSLink.h
Go to the documentation of this file.
1
/****************************************************************************/
9
// A connnection between lanes
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
#ifndef MSLink_h
23
#define MSLink_h
24
25
26
// ===========================================================================
27
// included modules
28
// ===========================================================================
29
#ifdef _MSC_VER
30
#include <
windows_config.h
>
31
#else
32
#include <
config.h
>
33
#endif
34
35
#include <vector>
36
#include <set>
37
#include <
utils/common/SUMOTime.h
>
38
#include <
utils/xml/SUMOXMLDefinitions.h
>
39
40
41
// ===========================================================================
42
// class declarations
43
// ===========================================================================
44
class
MSLane
;
45
class
SUMOVehicle
;
46
47
48
// ===========================================================================
49
// class definitions
50
// ===========================================================================
71
class
MSLink
{
72
public
:
73
#ifndef HAVE_INTERNAL_LANES
74
81
MSLink
(
MSLane
* succLane,
82
LinkDirection
dir,
LinkState
state,
SUMOReal
length) ;
83
#else
84
92
MSLink
(
MSLane
* succLane,
MSLane
* via,
93
LinkDirection
dir,
LinkState
state,
94
SUMOReal
length) ;
95
#endif
96
98
~MSLink
() ;
99
100
112
void
setRequestInformation
(
unsigned
int
requestIdx,
unsigned
int
respondIdx,
bool
isCrossing
,
bool
isCont
,
113
const
std::vector<MSLink*> &foeLinks,
const
std::vector<MSLane*> &foeLanes) ;
114
115
122
void
setApproaching
(
SUMOVehicle
* approaching,
SUMOTime
arrivalTime,
SUMOReal
speed,
bool
setRequest) ;
123
124
void
addBlockedLink
(
MSLink
* link) ;
125
126
127
128
void
removeApproaching
(
SUMOVehicle
* veh);
129
130
131
138
bool
opened
(
SUMOTime
arrivalTime,
SUMOReal
arrivalSpeed,
SUMOReal
vehicleLength)
const
;
139
140
bool
blockedAtTime
(
SUMOTime
arrivalTime,
SUMOTime
leaveTime)
const
;
141
bool
isBlockingAnyone
()
const
{
142
return
myApproachingVehicles
.size() != 0;
143
}
144
145
bool
willHaveBlockedFoe
()
const
;
146
147
148
155
bool
hasApproachingFoe
(
SUMOTime
arrivalTime,
SUMOTime
leaveTime)
const
;
156
157
162
LinkState
getState
()
const
{
163
return
myState
;
164
}
165
166
171
LinkDirection
getDirection
()
const
;
172
173
178
void
setTLState
(
LinkState
state,
SUMOTime
t) ;
179
180
185
MSLane
*
getLane
()
const
;
186
187
192
unsigned
int
getRespondIndex
()
const
;
193
194
198
bool
havePriority
()
const
{
199
return
myState
>=
'A'
&&
myState
<=
'Z'
;
200
}
201
202
207
SUMOReal
getLength
()
const
{
208
return
myLength
;
209
}
210
215
bool
isCrossing
()
const
{
216
return
myIsCrossing
;
217
}
218
219
220
bool
isCont
()
const
{
221
return
myAmCont
;
222
}
223
224
#ifdef HAVE_INTERNAL_LANES
225
229
MSLane
* getViaLane()
const
;
230
#endif
231
232
private
:
233
struct
ApproachingVehicleInformation
{
234
ApproachingVehicleInformation
(
const
SUMOTime
_arrivalTime,
const
SUMOTime
_leavingTime,
SUMOVehicle
* _vehicle,
const
bool
_willPass)
235
: arrivalTime(_arrivalTime),
leavingTime
(_leavingTime),
vehicle
(_vehicle),
willPass
(_willPass) {}
236
SUMOTime
arrivalTime
;
237
SUMOTime
leavingTime
;
238
SUMOVehicle
*
vehicle
;
239
bool
willPass
;
240
};
241
242
typedef
std::vector<ApproachingVehicleInformation>
LinkApproachingVehicles
;
243
244
class
vehicle_in_request_finder
{
245
public
:
246
explicit
vehicle_in_request_finder
(
const
SUMOVehicle
*
const
v) :
myVehicle
(v) { }
247
bool
operator()
(
const
ApproachingVehicleInformation
& vo) {
248
return
vo.
vehicle
==
myVehicle
;
249
}
250
private
:
251
vehicle_in_request_finder
&
operator=
(
const
vehicle_in_request_finder
&);
// just to avoid a compiler warning
252
private
:
253
const
SUMOVehicle
*
const
myVehicle
;
254
255
};
256
257
258
private
:
260
MSLane
*
myLane
;
261
262
LinkApproachingVehicles
myApproachingVehicles
;
263
std::set<MSLink*>
myBlockedFoeLinks
;
264
266
unsigned
int
myRequestIdx
;
267
269
unsigned
int
myRespondIdx
;
270
272
LinkState
myState
;
273
275
LinkDirection
myDirection
;
276
278
SUMOReal
myLength
;
279
281
bool
myIsCrossing
;
282
283
bool
myAmCont
;
284
285
#ifdef HAVE_INTERNAL_LANES
286
287
MSLane
*
const
myJunctionInlane;
288
#endif
289
290
std::vector<MSLink*>
myFoeLinks
;
291
std::vector<MSLane*>
myFoeLanes
;
292
static
SUMOTime
myLookaheadTime
;
293
294
295
private
:
297
MSLink
(
const
MSLink
& s);
298
300
MSLink
&
operator=
(
const
MSLink
& s);
301
302
};
303
304
305
#endif
306
307
/****************************************************************************/
308
var
build
temp
tmp.znCyBrHNjL
4.0-0-0
sumo
sumo-0.15.0~dfsg
src
microsim
MSLink.h
Generated on Mon Mar 24 2014 09:53:11 for SUMO - Simulation of Urban MObility by
1.8.1.2