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
NBTrafficLightLogic.h
Go to the documentation of this file.
1
/****************************************************************************/
9
// A SUMO-compliant built logic for a traffic light
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 NBTrafficLightLogic_h
23
#define NBTrafficLightLogic_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 "
NBConnectionDefs.h
"
41
#include <
utils/common/SUMOTime.h
>
42
#include <
utils/common/Named.h
>
43
44
45
// ===========================================================================
46
// class declarations
47
// ===========================================================================
48
class
OutputDevice
;
49
50
51
// ===========================================================================
52
// class definitions
53
// ===========================================================================
58
class
NBTrafficLightLogic
:
public
Named
{
59
public
:
64
class
PhaseDefinition
{
65
public
:
67
SUMOTime
duration
;
68
70
std::string
state
;
71
76
PhaseDefinition
(
SUMOTime
durationArg,
const
std::string& stateArg)
77
:
duration
(durationArg),
state
(stateArg) { }
78
80
~PhaseDefinition
() { }
81
86
bool
operator!=
(
const
PhaseDefinition
& pd)
const
{
87
return
pd.
duration
!=
duration
|| pd.
state
!=
state
;
88
}
89
90
};
91
92
98
NBTrafficLightLogic
(
const
std::string&
id
,
const
std::string& subid,
unsigned
int
noLinks) ;
99
100
104
NBTrafficLightLogic
(
const
NBTrafficLightLogic
* logic);
105
106
108
~NBTrafficLightLogic
() ;
109
110
119
void
addStep
(
SUMOTime
duration,
const
std::string& state,
int
index = -1);
120
121
127
void
setPhaseState
(
unsigned
int
phaseIndex,
int
tlIndex,
LinkState
linkState);
128
133
void
setPhaseDuration
(
unsigned
int
phaseIndex,
SUMOTime
duration);
134
135
/* @brief deletes the phase at the given index
136
* @note thhrows InvalidArgument on out-of range index
137
*/
138
void
deletePhase
(
unsigned
int
index);
139
140
/* @brief deletes all phases and reset the expect number of links
141
*/
142
void
resetPhases
();
143
148
void
closeBuilding
() ;
149
150
154
SUMOTime
getDuration
()
const
;
155
156
160
void
setOffset
(
SUMOTime
offset) {
161
myOffset
= offset;
162
}
163
164
168
const
std::string&
getProgramID
()
const
{
169
return
mySubID
;
170
};
171
172
176
const
std::vector<PhaseDefinition> &
getPhases
()
const
{
177
return
myPhases
;
178
}
179
180
184
SUMOTime
getOffset
()
const
{
185
return
myOffset
;
186
};
187
188
191
unsigned
int
getNumLinks
() {
192
return
myNumLinks
;
193
}
194
195
196
private
:
198
unsigned
int
myNumLinks
;
199
201
const
std::string
mySubID
;
202
204
SUMOTime
myOffset
;
205
207
typedef
std::vector<PhaseDefinition>
PhaseDefinitionVector
;
208
210
PhaseDefinitionVector
myPhases
;
211
213
static
const
char
allowedStatesInitializer
[];
214
static
const
std::string
ALLOWED_STATES
;
215
216
217
};
218
219
220
#endif
221
222
/****************************************************************************/
223
var
build
temp
tmp.znCyBrHNjL
4.0-0-0
sumo
sumo-0.15.0~dfsg
src
netbuild
NBTrafficLightLogic.h
Generated on Mon Mar 24 2014 09:53:12 for SUMO - Simulation of Urban MObility by
1.8.1.2