40 #ifdef CHECK_MEMORY_LEAKS 42 #endif // CHECK_MEMORY_LEAKS 50 const std::string&
id,
const std::string& subid,
const Phases& phases,
52 const std::map<std::string, std::string>& parameters
56 for (
size_t i = 0; i <
myPhases.size(); i++) {
131 assert((
int)
myPhases.size() > givenStep);
164 for (
unsigned int i = 0; i < index; i++) {
179 for (
unsigned int i = 0; i <
myPhases.size(); i++) {
184 if (testPos == pos) {
210 assert(step < (
int)phases.size());
219 for (
size_t i = 0; i <
myPhases.size(); i++) {
MSPhasedTrafficLightLogic(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.
void setPhases(const Phases &phases, int index)
Replaces the phases and set the phase index.
int getPhaseNumber() const
Returns the number of phases.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
void proceedToNextStep()
Proceed to the next step.
A class that stores and controls tls and switching of their programs.
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.
int getCurrentPhaseIndex() const
Returns the current index within the program.
SUMOTime myDefaultCycleTime
The cycle time (without changes)
SUMOTime myLastSwitch
Stores the timestep of the last on-switched of the phase.
Phases myPhases
The list of phases this logic uses.
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
const MSPhaseDefinition & getPhase(int givenstep) const
Returns the definition of the phase from the given position within the plan.
int myStep
The current step.
SUMOTime getOffsetFromIndex(unsigned int index) const
Returns the position (start of a phase during a cycle) from of a given step.
SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const
Returns the index of the logic at the given simulation step.
virtual SUMOTime addEvent(Command *operation, SUMOTime execTimeStep, AdaptType type)
Adds an Event.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
unsigned int getIndexFromOffset(SUMOTime offset) const
Returns the step (the phasenumber) of a given position of the cycle.
~MSPhasedTrafficLightLogic()
Destructor.
const Phases & getPhases() const
Returns the phases of this tls program.
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. ...
The definition of a single phase of a tls logic.
void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, unsigned int step, SUMOTime stepDuration)
Changes the current phase and her duration.
const MSPhaseDefinition & getCurrentPhaseDef() const
Returns the definition of the current phase.
void setStep(int step)
Forces a specific step.
void deletePhases()
frees memory responsibilities