![]() |
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) More... | |
void | addSwitchCommand (OnSwitchAction *c) |
bool | checkOriginalTLS () const |
Verifies traffic lights loaded from the network. More... | |
void | executeOnSwitchActions () const |
MSTrafficLightLogic * | getActive () const |
std::vector< MSTrafficLightLogic * > | getAllLogics () const |
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 | setStateInstantiatingOnline (MSTLLogicControl &tlc, const std::string &state) |
void | switchTo (MSTLLogicControl &tlc, const std::string &programID) |
TLSLogicVariants () | |
Constructor. More... | |
~TLSLogicVariants () | |
Destructor. More... | |
Private Member Functions | |
TLSLogicVariants & | operator= (const TLSLogicVariants &) |
Invalidated assignment operator. More... | |
TLSLogicVariants (const TLSLogicVariants &) | |
Invalidated copy constructor. More... | |
Private Attributes | |
MSTrafficLightLogic * | myCurrentProgram |
The currently used program. More... | |
std::map< MSLink *, LinkState > | myOriginalLinkStates |
Originally loaded link states. More... | |
std::vector< OnSwitchAction * > | mySwitchActions |
The list of actions/commands to execute on switch. More... | |
std::map< std::string, MSTrafficLightLogic * > | myVariants |
A map of subkeys to programs. More... | |
Storage for all programs of a single tls.
This class joins all programs of a single tls.
Definition at line 86 of file MSTLLogicControl.h.
MSTLLogicControl::TLSLogicVariants::TLSLogicVariants | ( | ) |
Constructor.
Definition at line 49 of file MSTLLogicControl.cpp.
MSTLLogicControl::TLSLogicVariants::~TLSLogicVariants | ( | ) |
Destructor.
Definition at line 54 of file MSTLLogicControl.cpp.
References mySwitchActions, and myVariants.
|
private |
Invalidated copy constructor.
Definition at line 220 of file MSTLLogicControl.cpp.
References myVariants.
Referenced by NLHandler::addConnection().
bool MSTLLogicControl::TLSLogicVariants::addLogic | ( | const std::string & | programID, |
MSTrafficLightLogic * | logic, | ||
bool | netWasLoaded, | ||
bool | isNewDefault = true |
||
) |
Adds a logic (program)
[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 93 of file MSTLLogicControl.cpp.
References MSTrafficLightLogic::adaptLinkInformationFrom(), executeOnSwitchActions(), Named::getID(), MSNet::getInstance(), MSTrafficLightLogic::getLinks(), MSTrafficLightLogic::getPhase(), MSPhaseDefinition::getState(), myCurrentProgram, myVariants, and MSTrafficLightLogic::setTrafficLightSignals().
Referenced by MSTLLogicControl::add(), getLogicInstantiatingOff(), libsumo::TrafficLight::setCompleteRedYellowGreenDefinition(), and setStateInstantiatingOnline().
void MSTLLogicControl::TLSLogicVariants::addSwitchCommand | ( | OnSwitchAction * | c | ) |
Definition at line 174 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 66 of file MSTLLogicControl.cpp.
References myVariants, and WRITE_ERROR.
void MSTLLogicControl::TLSLogicVariants::executeOnSwitchActions | ( | ) | const |
Definition at line 212 of file MSTLLogicControl.cpp.
References mySwitchActions.
Referenced by addLogic(), MSSimpleTrafficLightLogic::changeStepAndDuration(), MSTrafficLightLogic::SwitchCommand::execute(), and switchTo().
MSTrafficLightLogic * MSTLLogicControl::TLSLogicVariants::getActive | ( | ) | const |
Definition at line 197 of file MSTLLogicControl.cpp.
References myCurrentProgram.
Referenced by NLHandler::addConnection(), NLHandler::addE2Detector(), Command_SaveTLSState::execute(), Command_SaveTLSSwitchStates::execute(), Command_SaveTLSSwitches::execute(), libsumo::TrafficLight::getControlledJunctions(), libsumo::TrafficLight::getControlledLanes(), libsumo::TrafficLight::getControlledLinks(), libsumo::TrafficLight::getParameter(), libsumo::TrafficLight::getPhase(), libsumo::TrafficLight::getProgram(), libsumo::TrafficLight::getRedYellowGreenState(), MSTLLogicControl::initWautSwitch(), TraCIServerAPI_TrafficLight::processGet(), libsumo::TrafficLight::setParameter(), libsumo::TrafficLight::setPhase(), libsumo::TrafficLight::setPhaseDuration(), and MSFullExport::writeTLS().
std::vector< MSTrafficLightLogic * > MSTLLogicControl::TLSLogicVariants::getAllLogics | ( | ) | const |
Definition at line 180 of file MSTLLogicControl.cpp.
References myVariants.
Referenced by libsumo::TrafficLight::getCompleteRedYellowGreenDefinition(), GUITrafficLightLogicWrapper::getPopUpMenu(), GUIViewTraffic::onGamingClick(), and GUITrafficLightLogicWrapper::switchTLSLogic().
MSTrafficLightLogic * MSTLLogicControl::TLSLogicVariants::getLogic | ( | const std::string & | programID | ) | const |
Definition at line 124 of file MSTLLogicControl.cpp.
References myVariants.
Referenced by getLogicInstantiatingOff(), libsumo::TrafficLight::setCompleteRedYellowGreenDefinition(), and setStateInstantiatingOnline().
MSTrafficLightLogic * MSTLLogicControl::TLSLogicVariants::getLogicInstantiatingOff | ( | MSTLLogicControl & | tlc, |
const std::string & | programID | ||
) |
Definition at line 133 of file MSTLLogicControl.cpp.
References addLogic(), Named::getID(), getLogic(), myCurrentProgram, and myVariants.
Referenced by MSTLLogicControl::initWautSwitch(), and switchTo().
void MSTLLogicControl::TLSLogicVariants::ignoreLinkIndex | ( | int | pos | ) |
Definition at line 227 of file MSTLLogicControl.cpp.
References myVariants.
Referenced by NLHandler::addConnection().
bool MSTLLogicControl::TLSLogicVariants::isActive | ( | const MSTrafficLightLogic * | tl | ) | const |
Definition at line 191 of file MSTLLogicControl.cpp.
References myCurrentProgram.
Referenced by GUITrafficLightLogicWrapper::getPopUpMenu().
|
private |
Invalidated assignment operator.
void MSTLLogicControl::TLSLogicVariants::saveInitialStates | ( | ) |
Definition at line 87 of file MSTLLogicControl.cpp.
References MSTrafficLightLogic::collectLinkStates(), myCurrentProgram, and myOriginalLinkStates.
void MSTLLogicControl::TLSLogicVariants::setStateInstantiatingOnline | ( | MSTLLogicControl & | tlc, |
const std::string & | state | ||
) |
Definition at line 152 of file MSTLLogicControl.cpp.
References addLogic(), MSNet::createTLWrapper(), DELTA_T, MSNet::getCurrentTimeStep(), Named::getID(), MSNet::getInstance(), getLogic(), myCurrentProgram, switchTo(), and TLTYPE_STATIC.
Referenced by libsumo::TrafficLight::setRedYellowGreenState().
void MSTLLogicControl::TLSLogicVariants::switchTo | ( | MSTLLogicControl & | tlc, |
const std::string & | programID | ||
) |
Definition at line 203 of file MSTLLogicControl.cpp.
References executeOnSwitchActions(), MSNet::getInstance(), getLogicInstantiatingOff(), myCurrentProgram, and MSTrafficLightLogic::setTrafficLightSignals().
Referenced by libsumo::TrafficLight::setProgram(), and setStateInstantiatingOnline().
|
private |
The currently used program.
Definition at line 143 of file MSTLLogicControl.h.
Referenced by addLogic(), getActive(), getLogicInstantiatingOff(), isActive(), saveInitialStates(), setStateInstantiatingOnline(), and switchTo().
Originally loaded link states.
Definition at line 149 of file MSTLLogicControl.h.
Referenced by saveInitialStates().
|
private |
The list of actions/commands to execute on switch.
Definition at line 152 of file MSTLLogicControl.h.
Referenced by addSwitchCommand(), executeOnSwitchActions(), and ~TLSLogicVariants().
|
private |
A map of subkeys to programs.
Definition at line 146 of file MSTLLogicControl.h.
Referenced by addLink(), addLogic(), checkOriginalTLS(), getAllLogics(), getLogic(), getLogicInstantiatingOff(), ignoreLinkIndex(), and ~TLSLogicVariants().