48 #ifdef CHECK_MEMORY_LEAKS
50 #endif // CHECK_MEMORY_LEAKS
72 const std::string& subid,
unsigned int noLinks,
74 Named(id), myNumLinks(noLinks), mySubID(subid),
79 Named(logic->getID()),
80 myNumLinks(logic->myNumLinks),
81 mySubID(logic->getProgramID()),
82 myOffset(logic->getOffset()),
83 myPhases(logic->myPhases.begin(), logic->myPhases.end()),
84 myType(logic->getType()) {}
102 if (std::string::npos != illegal) {
103 throw ProcessError(
"When adding phase: illegal character '" +
toString(state[illegal]) +
"' in state");
106 if (index < 0 || index >= (
int)
myPhases.size()) {
134 for (PhaseDefinitionVector::const_iterator i =
myPhases.begin(); i !=
myPhases.end(); ++i) {
135 duration += (*i).duration;
143 for (
unsigned int i = 0; i <
myPhases.size() - 1;) {
156 assert(phaseIndex <
myPhases.size());
157 std::string& phaseState =
myPhases[phaseIndex].state;
158 assert(tlIndex < phaseState.size());
159 phaseState[tlIndex] = (char)linkState;
165 assert(phaseIndex <
myPhases.size());
166 myPhases[phaseIndex].duration = duration;
The link has green light, may pass.
static const std::string ALLOWED_STATES
void closeBuilding()
closes the building process
A SUMO-compliant built logic for a traffic light.
The link has green light, has to brake.
The definition of a single phase of the logic.
The link is controlled by a tls which is off, not blinking, may pass.
const std::string & getID() const
Returns the id.
void setPhaseDuration(unsigned int phaseIndex, SUMOTime duration)
Modifies the duration for an existing phase (used by NETEDIT)
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
void setPhaseState(unsigned int phaseIndex, unsigned int tlIndex, LinkState linkState)
Modifies the state for an existing phase (used by NETEDIT)
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
SUMOTime getDuration() const
Returns the duration of the complete cycle.
Base class for objects which have an id.
unsigned int myNumLinks
The number of participating links.
void deletePhase(unsigned int index)
The link has yellow light, may pass.
The link is controlled by a tls which is off and blinks, has to brake.
~NBTrafficLightLogic()
Destructor.
The link has red light (must brake)
NBTrafficLightLogic(const std::string &id, const std::string &subid, unsigned int noLinks, SUMOTime offset=0, TrafficLightType type=TLTYPE_STATIC)
Constructor.
The link has yellow light, has to brake anyway.
void addStep(SUMOTime duration, const std::string &state, int index=-1)
Adds a phase to the logic.
The link has red light (must brake) but indicates upcoming green.
PhaseDefinitionVector myPhases
The junction logic's storage for traffic light phase list.
static const char allowedStatesInitializer[]
all allowed characters for phase state (see SUMOXMLDefinitions)