![]() |
Eclipse SUMO - Simulation of Urban MObility
|
Storage for all programs of a single tls. More...
#include <MSTLLogicControl.h>
Public Member Functions | |
| void | addLink (MSLink *link, MSLane *lane, int pos) |
| bool | addLogic (const std::string &programID, MSTrafficLightLogic *logic, bool netWasLoaded, bool isNewDefault=true) |
| Adds a logic (program). In case of an error the logic gets deleted. | |
| void | addSwitchCommand (OnSwitchAction *c) |
| bool | checkOriginalTLS () const |
| Verifies traffic lights loaded from the network. | |
| void | executeOnSwitchActions () const |
| MSTrafficLightLogic * | getActive () const |
| std::vector< MSTrafficLightLogic * > | getAllLogics () const |
| MSTrafficLightLogic * | getDefault () const |
| return the default program (that last used program except TRACI_PROGRAM) | |
| MSTrafficLightLogic * | getLogic (const std::string &programID) const |
| MSTrafficLightLogic * | getLogicInstantiatingOff (MSTLLogicControl &tlc, const std::string &programID) |
| void | ignoreLinkIndex (int pos) |
| bool | isActive (const MSTrafficLightLogic *tl) const |
| void | saveInitialStates () |
| void | saveState (OutputDevice &out) |
| void | setStateInstantiatingOnline (MSTLLogicControl &tlc, const std::string &state) |
| void | switchTo (MSTLLogicControl &tlc, const std::string &programID) |
| TLSLogicVariants () | |
| Constructor. | |
| ~TLSLogicVariants () | |
| Destructor. | |
Private Member Functions | |
| TLSLogicVariants & | operator= (const TLSLogicVariants &) |
| Invalidated assignment operator. | |
| TLSLogicVariants (const TLSLogicVariants &) | |
| Invalidated copy constructor. | |
Private Attributes | |
| MSTrafficLightLogic * | myCurrentProgram |
| The currently used program. | |
| MSTrafficLightLogic * | myDefaultProgram |
| The program that would be used in the absence of TraCI. | |
| std::map< MSLink *, LinkState > | myOriginalLinkStates |
| Originally loaded link states. | |
| std::vector< OnSwitchAction * > | mySwitchActions |
| The list of actions/commands to execute on switch. | |
| std::map< std::string, MSTrafficLightLogic * > | myVariants |
| A map of subkeys to programs. | |
Storage for all programs of a single tls.
This class joins all programs of a single tls.
Definition at line 85 of file MSTLLogicControl.h.
| MSTLLogicControl::TLSLogicVariants::TLSLogicVariants | ( | ) |
Constructor.
Definition at line 52 of file MSTLLogicControl.cpp.
References myCurrentProgram, and myDefaultProgram.
Referenced by operator=(), and TLSLogicVariants().
| MSTLLogicControl::TLSLogicVariants::~TLSLogicVariants | ( | ) |
Destructor.
Definition at line 58 of file MSTLLogicControl.cpp.
References mySwitchActions, and myVariants.
|
private |
Invalidated copy constructor.
References TLSLogicVariants().
Definition at line 252 of file MSTLLogicControl.cpp.
References myVariants.
| bool MSTLLogicControl::TLSLogicVariants::addLogic | ( | const std::string & | programID, |
| MSTrafficLightLogic * | logic, | ||
| bool | netWasLoaded, | ||
| bool | isNewDefault = true ) |
Adds a logic (program). In case of an error the logic gets deleted.
| [in] | programID | The sub-id of this program |
| [in] | logic | The logic to add |
| [in] | netWasLoaded | Whether the network has already been loaded (the links have been assigned) |
| [in] | isNewDefault | Whether this logic shall be treated as the currently active logic |
Definition at line 105 of file MSTLLogicControl.cpp.
References MSTrafficLightLogic::adaptLinkInformationFrom(), executeOnSwitchActions(), Named::getID(), MSNet::getInstance(), MSTrafficLightLogic::getLinks(), MSTrafficLightLogic::getPhase(), MSPhaseDefinition::getState(), myCurrentProgram, myDefaultProgram, myVariants, MSTrafficLightLogic::setTrafficLightSignals(), and TLF.
Referenced by MSTLLogicControl::add(), getLogicInstantiatingOff(), LIBSUMO_NAMESPACE::TrafficLight::setProgramLogic(), and setStateInstantiatingOnline().
| void MSTLLogicControl::TLSLogicVariants::addSwitchCommand | ( | OnSwitchAction * | c | ) |
Definition at line 199 of file MSTLLogicControl.cpp.
References mySwitchActions.
Referenced by Command_SaveTLCoupledDet::Command_SaveTLCoupledDet().
| bool MSTLLogicControl::TLSLogicVariants::checkOriginalTLS | ( | ) | const |
Verifies traffic lights loaded from the network.
Compare the phase state sizes of each phase with the according tls' number of controlled links.
Definition at line 70 of file MSTLLogicControl.cpp.
References myVariants, TL, and WRITE_ERRORF.
| void MSTLLogicControl::TLSLogicVariants::executeOnSwitchActions | ( | ) | const |
Definition at line 244 of file MSTLLogicControl.cpp.
References mySwitchActions.
Referenced by addLogic(), MSActuatedTrafficLightLogic::changeStepAndDuration(), MSSimpleTrafficLightLogic::changeStepAndDuration(), MSTrafficLightLogic::SwitchCommand::execute(), MSActuatedTrafficLightLogic::loadState(), LIBSUMO_NAMESPACE::TrafficLight::setProgramLogic(), and switchTo().
| MSTrafficLightLogic * MSTLLogicControl::TLSLogicVariants::getActive | ( | ) | const |
Definition at line 222 of file MSTLLogicControl.cpp.
References myCurrentProgram.
Referenced by NLHandler::addE2Detector(), LIBSUMO_NAMESPACE::TrafficLight::getControlledJunctions(), LIBSUMO_NAMESPACE::TrafficLight::getControlledLanes(), LIBSUMO_NAMESPACE::TrafficLight::getControlledLinks(), LIBSUMO_NAMESPACE::TrafficLight::getPhase(), LIBSUMO_NAMESPACE::TrafficLight::getPhaseName(), GUITrafficLightLogicWrapper::getPopUpMenu(), LIBSUMO_NAMESPACE::TrafficLight::getProgram(), LIBSUMO_NAMESPACE::TrafficLight::getRedYellowGreenState(), LIBSUMO_NAMESPACE::TrafficLight::getServedPersonCount(), GUIApplicationWindow::handleEvent_SimulationLoaded(), MSTLLogicControl::initWautSwitch(), LIBSUMO_NAMESPACE::TrafficLight::setPhase(), LIBSUMO_NAMESPACE::TrafficLight::setPhaseDuration(), LIBSUMO_NAMESPACE::TrafficLight::setPhaseName(), and MSFullExport::writeTLS().
| std::vector< MSTrafficLightLogic * > MSTLLogicControl::TLSLogicVariants::getAllLogics | ( | ) | const |
Definition at line 205 of file MSTLLogicControl.cpp.
References myVariants.
Referenced by LIBSUMO_NAMESPACE::TrafficLight::getAllProgramLogics(), GUITrafficLightLogicWrapper::getPopUpMenu(), and GUITrafficLightLogicWrapper::switchTLSLogic().
| MSTrafficLightLogic * MSTLLogicControl::TLSLogicVariants::getDefault | ( | ) | const |
return the default program (that last used program except TRACI_PROGRAM)
Definition at line 227 of file MSTLLogicControl.cpp.
References myDefaultProgram.
Referenced by LIBSUMO_NAMESPACE::TrafficLight::addConstraint(), NLHandler::addPredecessorConstraint(), LIBSUMO_NAMESPACE::TrafficLight::getBlockingVehicles(), LIBSUMO_NAMESPACE::TrafficLight::getConstraints(), LIBSUMO_NAMESPACE::TrafficLight::getConstraintsByFoe(), LIBSUMO_NAMESPACE::TrafficLight::getPriorityVehicles(), LIBSUMO_NAMESPACE::TrafficLight::getRivalVehicles(), MSStateHandler::myStartElement(), NLHandler::myStartElement(), LIBSUMO_NAMESPACE::TrafficLight::removeConstraints(), and LIBSUMO_NAMESPACE::TrafficLight::swapConstraints().
| MSTrafficLightLogic * MSTLLogicControl::TLSLogicVariants::getLogic | ( | const std::string & | programID | ) | const |
Definition at line 148 of file MSTLLogicControl.cpp.
References myVariants.
Referenced by getLogicInstantiatingOff(), LIBSUMO_NAMESPACE::TrafficLight::setProgramLogic(), and setStateInstantiatingOnline().
| MSTrafficLightLogic * MSTLLogicControl::TLSLogicVariants::getLogicInstantiatingOff | ( | MSTLLogicControl & | tlc, |
| const std::string & | programID ) |
Definition at line 157 of file MSTLLogicControl.cpp.
References addLogic(), getLogic(), MSTLLogicControl::MSTLLogicControl(), myCurrentProgram, myVariants, and TLF.
Referenced by MSTLLogicControl::initWautSwitch(), and switchTo().
| void MSTLLogicControl::TLSLogicVariants::ignoreLinkIndex | ( | int | pos | ) |
Definition at line 259 of file MSTLLogicControl.cpp.
References myVariants.
| bool MSTLLogicControl::TLSLogicVariants::isActive | ( | const MSTrafficLightLogic * | tl | ) | const |
Definition at line 216 of file MSTLLogicControl.cpp.
References myCurrentProgram.
Referenced by GUITrafficLightLogicWrapper::getPopUpMenu().
|
private |
Invalidated assignment operator.
References TLSLogicVariants().
| void MSTLLogicControl::TLSLogicVariants::saveInitialStates | ( | ) |
Definition at line 91 of file MSTLLogicControl.cpp.
References myCurrentProgram, and myOriginalLinkStates.
| void MSTLLogicControl::TLSLogicVariants::saveState | ( | OutputDevice & | out | ) |
Definition at line 97 of file MSTLLogicControl.cpp.
References myVariants.
| void MSTLLogicControl::TLSLogicVariants::setStateInstantiatingOnline | ( | MSTLLogicControl & | tlc, |
| const std::string & | state ) |
Definition at line 176 of file MSTLLogicControl.cpp.
References addLogic(), MSNet::createTLWrapper(), DELTA_T, MSNet::getInstance(), getLogic(), MSSimpleTrafficLightLogic::getPhases(), MSTLLogicControl::MSTLLogicControl(), myCurrentProgram, STATIC, MSTLLogicControl::switchTo(), and TRACI_PROGRAM.
Referenced by LIBSUMO_NAMESPACE::TrafficLight::setRedYellowGreenState().
| void MSTLLogicControl::TLSLogicVariants::switchTo | ( | MSTLLogicControl & | tlc, |
| const std::string & | programID ) |
Definition at line 233 of file MSTLLogicControl.cpp.
References executeOnSwitchActions(), MSNet::getInstance(), getLogicInstantiatingOff(), MSTLLogicControl::MSTLLogicControl(), and myCurrentProgram.
Referenced by LIBSUMO_NAMESPACE::TrafficLight::setProgram().
|
private |
The currently used program.
Definition at line 141 of file MSTLLogicControl.h.
Referenced by addLogic(), getActive(), getLogicInstantiatingOff(), isActive(), saveInitialStates(), setStateInstantiatingOnline(), switchTo(), and TLSLogicVariants().
|
private |
The program that would be used in the absence of TraCI.
Definition at line 144 of file MSTLLogicControl.h.
Referenced by addLogic(), getDefault(), and TLSLogicVariants().
Originally loaded link states.
Definition at line 150 of file MSTLLogicControl.h.
Referenced by saveInitialStates().
|
private |
The list of actions/commands to execute on switch.
Definition at line 153 of file MSTLLogicControl.h.
Referenced by addSwitchCommand(), executeOnSwitchActions(), and ~TLSLogicVariants().
|
private |
A map of subkeys to programs.
Definition at line 147 of file MSTLLogicControl.h.
Referenced by addLink(), addLogic(), checkOriginalTLS(), getAllLogics(), getLogic(), getLogicInstantiatingOff(), ignoreLinkIndex(), saveState(), and ~TLSLogicVariants().