Eclipse SUMO - Simulation of Urban MObility
MSTLLogicControl::TLSLogicVariants Class Reference

Storage for all programs of a single tls. More...

#include <MSTLLogicControl.h>

Collaboration diagram for MSTLLogicControl::TLSLogicVariants:

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
 
MSTrafficLightLogicgetActive () const
 
std::vector< MSTrafficLightLogic * > getAllLogics () const
 
MSTrafficLightLogicgetLogic (const std::string &programID) const
 
MSTrafficLightLogicgetLogicInstantiatingOff (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

TLSLogicVariantsoperator= (const TLSLogicVariants &)
 Invalidated assignment operator. More...
 
 TLSLogicVariants (const TLSLogicVariants &)
 Invalidated copy constructor. More...
 

Private Attributes

MSTrafficLightLogicmyCurrentProgram
 The currently used program. More...
 
std::map< MSLink *, LinkStatemyOriginalLinkStates
 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ TLSLogicVariants() [1/2]

MSTLLogicControl::TLSLogicVariants::TLSLogicVariants ( )

Constructor.

Definition at line 49 of file MSTLLogicControl.cpp.

◆ ~TLSLogicVariants()

MSTLLogicControl::TLSLogicVariants::~TLSLogicVariants ( )

Destructor.

Definition at line 54 of file MSTLLogicControl.cpp.

◆ TLSLogicVariants() [2/2]

MSTLLogicControl::TLSLogicVariants::TLSLogicVariants ( const TLSLogicVariants )
private

Invalidated copy constructor.

Member Function Documentation

◆ addLink()

void MSTLLogicControl::TLSLogicVariants::addLink ( MSLink link,
MSLane lane,
int  pos 
)

Definition at line 220 of file MSTLLogicControl.cpp.

Referenced by NLHandler::addConnection().

◆ addLogic()

bool MSTLLogicControl::TLSLogicVariants::addLogic ( const std::string &  programID,
MSTrafficLightLogic logic,
bool  netWasLoaded,
bool  isNewDefault = true 
)

Adds a logic (program)

Parameters
[in]programIDThe sub-id of this program
[in]logicThe logic to add
[in]netWasLoadedWhether the network has already been loaded (the links have been assigned)
[in]isNewDefaultWhether this logic shall be treated as the currently active logic

Definition at line 93 of file MSTLLogicControl.cpp.

References MSTrafficLightLogic::adaptLinkInformationFrom(), Named::getID(), MSNet::getInstance(), MSTrafficLightLogic::getLinks(), MSTrafficLightLogic::getPhase(), MSPhaseDefinition::getState(), and MSTrafficLightLogic::setTrafficLightSignals().

Referenced by MSTLLogicControl::add(), and libsumo::TrafficLight::setCompleteRedYellowGreenDefinition().

◆ addSwitchCommand()

void MSTLLogicControl::TLSLogicVariants::addSwitchCommand ( OnSwitchAction c)

◆ checkOriginalTLS()

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.

Returns
Whether all tls programs are valid

Definition at line 66 of file MSTLLogicControl.cpp.

References WRITE_ERROR.

◆ executeOnSwitchActions()

void MSTLLogicControl::TLSLogicVariants::executeOnSwitchActions ( ) const

◆ getActive()

◆ getAllLogics()

◆ getLogic()

MSTrafficLightLogic * MSTLLogicControl::TLSLogicVariants::getLogic ( const std::string &  programID) const

◆ getLogicInstantiatingOff()

MSTrafficLightLogic * MSTLLogicControl::TLSLogicVariants::getLogicInstantiatingOff ( MSTLLogicControl tlc,
const std::string &  programID 
)

Definition at line 133 of file MSTLLogicControl.cpp.

Referenced by MSTLLogicControl::initWautSwitch().

◆ ignoreLinkIndex()

void MSTLLogicControl::TLSLogicVariants::ignoreLinkIndex ( int  pos)

Definition at line 227 of file MSTLLogicControl.cpp.

Referenced by NLHandler::addConnection().

◆ isActive()

bool MSTLLogicControl::TLSLogicVariants::isActive ( const MSTrafficLightLogic tl) const

Definition at line 191 of file MSTLLogicControl.cpp.

Referenced by GUITrafficLightLogicWrapper::getPopUpMenu().

◆ operator=()

TLSLogicVariants& MSTLLogicControl::TLSLogicVariants::operator= ( const TLSLogicVariants )
private

Invalidated assignment operator.

◆ saveInitialStates()

void MSTLLogicControl::TLSLogicVariants::saveInitialStates ( )

Definition at line 87 of file MSTLLogicControl.cpp.

◆ setStateInstantiatingOnline()

void MSTLLogicControl::TLSLogicVariants::setStateInstantiatingOnline ( MSTLLogicControl tlc,
const std::string &  state 
)

◆ switchTo()

void MSTLLogicControl::TLSLogicVariants::switchTo ( MSTLLogicControl tlc,
const std::string &  programID 
)

Definition at line 203 of file MSTLLogicControl.cpp.

References MSNet::getInstance().

Referenced by libsumo::TrafficLight::setProgram().

Field Documentation

◆ myCurrentProgram

MSTrafficLightLogic* MSTLLogicControl::TLSLogicVariants::myCurrentProgram
private

The currently used program.

Definition at line 143 of file MSTLLogicControl.h.

◆ myOriginalLinkStates

std::map<MSLink*, LinkState> MSTLLogicControl::TLSLogicVariants::myOriginalLinkStates
private

Originally loaded link states.

Definition at line 149 of file MSTLLogicControl.h.

◆ mySwitchActions

std::vector<OnSwitchAction*> MSTLLogicControl::TLSLogicVariants::mySwitchActions
private

The list of actions/commands to execute on switch.

Definition at line 152 of file MSTLLogicControl.h.

◆ myVariants

std::map<std::string, MSTrafficLightLogic*> MSTLLogicControl::TLSLogicVariants::myVariants
private

A map of subkeys to programs.

Definition at line 146 of file MSTLLogicControl.h.


The documentation for this class was generated from the following files: