45 #ifdef CHECK_MEMORY_LEAKS
47 #endif // CHECK_MEMORY_LEAKS
54 const std::string&
id,
const std::string& subid,
const Phases& phases,
56 const std::map<std::string, std::string>& parameters) :
60 for (
size_t i = 0; i <
myPhases.size(); i++) {
105 return (
unsigned int)
myPhases.size();
123 assert(
myPhases.size() > givenStep);
146 for (
unsigned int i = 0; i <
myStep; i++) {
163 unsigned int pos = 0;
164 for (
unsigned int i = 0; i < index; i++) {
178 for (
unsigned int i = 0; i <
myPhases.size(); i++) {
180 if (testPos > offset) {
183 if (testPos == offset) {
211 assert(step < phases.size());
220 for (
size_t i = 0; i <
myPhases.size(); i++) {
SUMOTime myCurrentDurationIncrement
A value for enlarge the current duration.
void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, unsigned int step, SUMOTime stepDuration)
Changes the current phase and her duration.
unsigned int getPhaseNumber() const
Returns the number of phases.
unsigned int getIndexFromOffset(SUMOTime offset) const
Returns the step (the phasenumber) of a given position of the cycle.
bool setTrafficLightSignals(SUMOTime t) const
Applies the current signal states to controlled links.
std::vector< SUMOTime > myOverridingTimes
A list of duration overrides.
unsigned int myStep
The current step.
const Phases & getPhases() const
Returns the phases of this tls program.
SUMOTime trySwitch(bool isActive)
Switches to the next phase.
Phases myPhases
The list of phases this logic uses.
SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const
Returns the index of the logic at the given simulation step.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOTime getCurrentTimeStep() const
Returns the current simulation step (in s)
A class that stores and controls tls and switching of their programs.
const std::string & getID() const
Returns the id.
SUMOTime duration
The duration of the phase.
void deschedule(MSTrafficLightLogic *tlLogic)
Marks this swicth as invalid (if the phase duration has changed, f.e.)
Class realising the switch between the traffic light phases.
SUMOTime myDefaultCycleTime
The cycle time (without changes)
SUMOTime myLastSwitch
Stores the timestep of the last on-switched of the phase.
const MSPhaseDefinition & getCurrentPhaseDef() const
Returns the definition of the current phase.
const MSPhaseDefinition & getPhase(unsigned int givenstep) const
Returns the definition of the phase from the given position within the plan.
void deletePhases()
frees memory responsibilities
MSSimpleTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &subid, const Phases &phases, unsigned int step, SUMOTime delay, const std::map< std::string, std::string > ¶meters)
Constructor.
virtual SUMOTime addEvent(Command *operation, SUMOTime execTimeStep, AdaptType type)
Adds an Event.
~MSSimpleTrafficLightLogic()
Destructor.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
unsigned int getCurrentPhaseIndex() const
Returns the current index within the program.
void executeOnSwitchActions() const
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
SwitchCommand * mySwitchCommand
The current switch command.
The parent class for traffic light logics.
Patch the time in a way that it is at least as high as the simulation begin time. ...
void setPhases(const Phases &phases, unsigned int index)
Replaces the phases and set the phase index.
MSEventControl & getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
SUMOTime getOffsetFromIndex(unsigned int index) const
Returns the position (start of a phase during a cycle) from of a given step.
The definition of a single phase of a tls logic.