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
NBTrafficLightDefinition.h
Go to the documentation of this file.
1
/****************************************************************************/
9
// The base class for traffic light logic definitions
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12
// Copyright (C) 2002-2014 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 NBTrafficLightDefinition_h
23
#define NBTrafficLightDefinition_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 <string>
37
#include <bitset>
38
#include <utility>
39
#include <set>
40
#include <
utils/common/StdDefs.h
>
41
#include <
utils/common/Named.h
>
42
#include <
utils/common/VectorHelper.h
>
43
#include <
utils/common/SUMOTime.h
>
44
#include <
utils/common/UtilExceptions.h
>
45
#include <
utils/common/Parameterised.h
>
46
#include "
NBCont.h
"
47
#include "
NBConnection.h
"
48
#include "
NBConnectionDefs.h
"
49
#include "
NBLinkPossibilityMatrix.h
"
50
51
52
// ===========================================================================
53
// class declarations
54
// ===========================================================================
55
class
NBNode
;
56
class
OptionsCont
;
57
class
NBTrafficLightLogic
;
58
59
60
// ===========================================================================
61
// class definitions
62
// ===========================================================================
75
class
NBTrafficLightDefinition
:
public
Named
,
public
Parameterised
{
76
public
:
77
78
static
const
std::string
DefaultProgramID
;
79
84
enum
TLColor
{
86
TLCOLOR_RED
,
88
TLCOLOR_YELLOW
,
90
TLCOLOR_REDYELLOW
,
92
TLCOLOR_GREEN
,
94
TLCOLOR_BLINK
95
};
96
97
105
NBTrafficLightDefinition
(
const
std::string&
id
,
106
const
std::vector<NBNode*>& junctions,
107
const
std::string& programID,
108
SUMOTime
offset,
109
TrafficLightType
type);
110
111
119
NBTrafficLightDefinition
(
const
std::string&
id
,
120
NBNode
* junction,
121
const
std::string& programID,
122
SUMOTime
offset,
123
TrafficLightType
type);
124
125
132
NBTrafficLightDefinition
(
const
std::string&
id
,
const
std::string& programID,
133
SUMOTime
offset,
134
TrafficLightType
type);
135
136
138
virtual
~NBTrafficLightDefinition
();
139
140
150
NBTrafficLightLogic
*
compute
(
const
NBEdgeCont
& ec,
OptionsCont
& oc);
151
152
153
156
160
virtual
void
addNode
(
NBNode
* node);
161
162
166
virtual
void
removeNode
(
NBNode
* node);
167
168
172
const
std::vector<NBNode*>&
getNodes
()
const
{
173
return
myControlledNodes
;
174
}
176
177
188
bool
mustBrake
(
const
NBEdge
*
const
from,
const
NBEdge
*
const
to)
const
;
189
190
198
bool
mustBrake
(
const
NBConnection
& possProhibited,
199
const
NBConnection
& possProhibitor,
200
bool
regardNonSignalisedLowerPriority)
const
;
201
211
bool
mustBrake
(
const
NBEdge
*
const
possProhibitedFrom,
const
NBEdge
*
const
possProhibitedTo,
212
const
NBEdge
*
const
possProhibitorFrom,
const
NBEdge
*
const
possProhibitorTo,
213
bool
regardNonSignalisedLowerPriority)
const
;
214
215
225
bool
forbids
(
const
NBEdge
*
const
possProhibitorFrom,
const
NBEdge
*
const
possProhibitorTo,
226
const
NBEdge
*
const
possProhibitedFrom,
const
NBEdge
*
const
possProhibitedTo,
227
bool
regardNonSignalisedLowerPriority)
const
;
228
229
237
bool
foes
(
const
NBEdge
*
const
from1,
const
NBEdge
*
const
to1,
238
const
NBEdge
*
const
from2,
const
NBEdge
*
const
to2)
const
;
239
240
244
virtual
void
setTLControllingInformation
(
const
NBEdgeCont
& ec)
const
= 0;
245
246
249
virtual
void
setParticipantsInformation
();
250
251
255
void
addControlledInnerEdges
(
const
std::vector<std::string>& edges);
256
259
std::vector<std::string>
getControlledInnerEdges
()
const
;
260
266
virtual
void
remapRemoved
(
NBEdge
* removed,
267
const
EdgeVector
& incoming,
const
EdgeVector
& outgoing) = 0;
268
269
276
virtual
void
replaceRemoved
(
NBEdge
* removed,
int
removedLane,
277
NBEdge
* by,
int
byLane) = 0;
278
280
virtual
void
shiftTLConnectionLaneIndex
(
NBEdge
* edge,
int
offset) {
281
UNUSED_PARAMETER
(edge);
282
UNUSED_PARAMETER
(offset);
283
}
284
290
bool
isLeftMover
(
const
NBEdge
*
const
from,
const
NBEdge
*
const
to)
const
;
291
292
296
const
EdgeVector
&
getIncomingEdges
()
const
;
297
298
300
const
NBConnectionVector
&
getControlledLinks
()
const
{
301
return
myControlledLinks
;
302
}
303
304
308
const
std::string&
getProgramID
()
const
{
309
return
mySubID
;
310
};
311
312
316
void
setProgramID
(
const
std::string& programID) {
317
mySubID
= programID;
318
}
319
320
324
SUMOTime
getOffset
() {
325
return
myOffset
;
326
}
327
328
330
TrafficLightType
getType
()
const
{
331
return
myType
;
332
}
333
334
protected
:
340
virtual
NBTrafficLightLogic
*
myCompute
(
const
NBEdgeCont
& ec,
341
unsigned
int
brakingTime) = 0;
342
343
347
virtual
void
collectLinks
() = 0;
348
349
352
void
collectEdges
();
353
354
360
unsigned
int
computeBrakingTime
(
SUMOReal
minDecel)
const
;
361
362
363
// @return whether this traffic light is invalid and should be computed
364
virtual
bool
amInvalid
()
const
;
365
367
void
collectAllLinks
();
368
369
370
protected
:
372
std::vector<NBNode*>
myControlledNodes
;
373
375
EdgeVector
myIncomingEdges
;
376
378
EdgeVector
myEdgesWithin
;
379
381
NBConnectionVector
myControlledLinks
;
382
384
std::set<std::string>
myControlledInnerEdges
;
385
387
std::string
mySubID
;
388
390
SUMOTime
myOffset
;
391
393
TrafficLightType
myType
;
394
395
396
};
397
398
399
#endif
400
401
/****************************************************************************/
402
tmp
buildd
sumo-0.21.0+dfsg
src
netbuild
NBTrafficLightDefinition.h
Generated on Thu Nov 20 2014 19:49:56 for SUMO - Simulation of Urban MObility by
1.8.1.2