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
/****************************************************************************/
8
// The base class for traffic light logic definitions
9
/****************************************************************************/
10
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11
// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
12
/****************************************************************************/
13
//
14
// This file is part of SUMO.
15
// SUMO is free software: you can redistribute it and/or modify
16
// it under the terms of the GNU General Public License as published by
17
// the Free Software Foundation, either version 3 of the License, or
18
// (at your option) any later version.
19
//
20
/****************************************************************************/
21
#ifndef NBTrafficLightDefinition_h
22
#define NBTrafficLightDefinition_h
23
24
25
// ===========================================================================
26
// included modules
27
// ===========================================================================
28
#ifdef _MSC_VER
29
#include <
windows_config.h
>
30
#else
31
#include <
config.h
>
32
#endif
33
34
#include <vector>
35
#include <string>
36
#include <bitset>
37
#include <utility>
38
#include <set>
39
#include <
utils/common/Named.h
>
40
#include <
utils/common/VectorHelper.h
>
41
#include <
utils/common/SUMOTime.h
>
42
#include <
utils/common/UtilExceptions.h
>
43
#include <
utils/common/Parameterised.h
>
44
#include "
NBCont.h
"
45
#include "
NBConnection.h
"
46
#include "
NBConnectionDefs.h
"
47
#include "
NBLinkPossibilityMatrix.h
"
48
49
50
// ===========================================================================
51
// class declarations
52
// ===========================================================================
53
class
NBNode
;
54
class
OptionsCont
;
55
class
NBTrafficLightLogic
;
56
57
58
// ===========================================================================
59
// class definitions
60
// ===========================================================================
73
class
NBTrafficLightDefinition
:
public
Named
,
public
Parameterised
{
74
public
:
75
76
static
const
std::string
DefaultProgramID
;
77
82
enum
TLColor
{
84
TLCOLOR_RED
,
86
TLCOLOR_YELLOW
,
88
TLCOLOR_REDYELLOW
,
90
TLCOLOR_GREEN
,
92
TLCOLOR_BLINK
93
};
94
95
103
NBTrafficLightDefinition
(
const
std::string&
id
,
104
const
std::vector<NBNode*>& junctions,
105
const
std::string& programID,
106
SUMOTime
offset,
107
TrafficLightType
type);
108
109
117
NBTrafficLightDefinition
(
const
std::string&
id
,
118
NBNode
* junction,
119
const
std::string& programID,
120
SUMOTime
offset,
121
TrafficLightType
type);
122
123
130
NBTrafficLightDefinition
(
const
std::string&
id
,
const
std::string& programID,
131
SUMOTime
offset,
132
TrafficLightType
type);
133
134
136
virtual
~NBTrafficLightDefinition
();
137
138
148
NBTrafficLightLogic
*
compute
(
const
NBEdgeCont
& ec,
OptionsCont
& oc);
149
150
151
154
158
virtual
void
addNode
(
NBNode
* node);
159
160
164
virtual
void
removeNode
(
NBNode
* node);
165
166
170
const
std::vector<NBNode*>&
getNodes
()
const
{
171
return
myControlledNodes
;
172
}
174
175
186
bool
mustBrake
(
const
NBEdge
*
const
from,
const
NBEdge
*
const
to)
const
;
187
188
196
bool
mustBrake
(
const
NBConnection
& possProhibited,
197
const
NBConnection
& possProhibitor,
198
bool
regardNonSignalisedLowerPriority)
const
;
199
209
bool
mustBrake
(
const
NBEdge
*
const
possProhibitedFrom,
const
NBEdge
*
const
possProhibitedTo,
210
const
NBEdge
*
const
possProhibitorFrom,
const
NBEdge
*
const
possProhibitorTo,
211
bool
regardNonSignalisedLowerPriority)
const
;
212
213
223
bool
forbids
(
const
NBEdge
*
const
possProhibitorFrom,
const
NBEdge
*
const
possProhibitorTo,
224
const
NBEdge
*
const
possProhibitedFrom,
const
NBEdge
*
const
possProhibitedTo,
225
bool
regardNonSignalisedLowerPriority)
const
;
226
227
235
bool
foes
(
const
NBEdge
*
const
from1,
const
NBEdge
*
const
to1,
236
const
NBEdge
*
const
from2,
const
NBEdge
*
const
to2)
const
;
237
238
242
virtual
void
setTLControllingInformation
(
const
NBEdgeCont
& ec)
const
= 0;
243
244
247
virtual
void
setParticipantsInformation
();
248
249
253
void
addControlledInnerEdges
(
const
std::vector<std::string>& edges);
254
255
261
virtual
void
remapRemoved
(
NBEdge
* removed,
262
const
EdgeVector
& incoming,
const
EdgeVector
& outgoing) = 0;
263
264
271
virtual
void
replaceRemoved
(
NBEdge
* removed,
int
removedLane,
272
NBEdge
* by,
int
byLane) = 0;
273
274
280
bool
isLeftMover
(
const
NBEdge
*
const
from,
const
NBEdge
*
const
to)
const
;
281
282
286
const
EdgeVector
&
getIncomingEdges
()
const
;
287
288
290
const
NBConnectionVector
&
getControlledLinks
()
const
{
291
return
myControlledLinks
;
292
}
293
294
295
// @breif returns the controlled nodes
296
const
std::vector<NBNode*>&
getControlledNodes
()
const
{
297
return
myControlledNodes
;
298
}
299
300
304
const
std::string&
getProgramID
()
const
{
305
return
mySubID
;
306
};
307
308
312
void
setProgramID
(
const
std::string& programID) {
313
mySubID
= programID;
314
}
315
316
320
SUMOTime
getOffset
() {
321
return
myOffset
;
322
}
323
324
326
TrafficLightType
getType
()
const
{
327
return
myType
;
328
}
329
330
protected
:
336
virtual
NBTrafficLightLogic
*
myCompute
(
const
NBEdgeCont
& ec,
337
unsigned
int
brakingTime) = 0;
338
339
343
virtual
void
collectLinks
() = 0;
344
345
348
void
collectEdges
();
349
350
356
unsigned
int
computeBrakingTime
(
SUMOReal
minDecel)
const
;
357
358
359
// @return whether this traffic light is invalid and should be computed
360
virtual
bool
amInvalid
()
const
;
361
363
void
collectAllLinks
();
364
365
366
protected
:
368
std::vector<NBNode*>
myControlledNodes
;
369
371
EdgeVector
myIncomingEdges
;
372
374
EdgeVector
myEdgesWithin
;
375
377
NBConnectionVector
myControlledLinks
;
378
380
std::set<std::string>
myControlledInnerEdges
;
381
383
std::string
mySubID
;
384
386
SUMOTime
myOffset
;
387
389
TrafficLightType
myType
;
390
391
392
};
393
394
395
#endif
396
397
/****************************************************************************/
398
home
delphi
sumo
src
netbuild
NBTrafficLightDefinition.h
Generated by
1.8.2