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:
Collaboration graph

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)
 
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 93 of file MSTLLogicControl.h.

Constructor & Destructor Documentation

MSTLLogicControl::TLSLogicVariants::TLSLogicVariants ( )

Constructor.

Definition at line 60 of file MSTLLogicControl.cpp.

MSTLLogicControl::TLSLogicVariants::~TLSLogicVariants ( )

Destructor.

Definition at line 65 of file MSTLLogicControl.cpp.

References mySwitchActions, and myVariants.

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

Invalidated copy constructor.

Member Function Documentation

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

Definition at line 230 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)

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 104 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(), TraCIServerAPI_TLS::processSet(), and setStateInstantiatingOnline().

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

Definition at line 184 of file MSTLLogicControl.cpp.

References mySwitchActions.

Referenced by Command_SaveTLCoupledDet::Command_SaveTLCoupledDet().

bool MSTLLogicControl::TLSLogicVariants::checkOriginalTLS ( ) const

Verifies traffic lights loaded from the network.

Comparse the phase state sizes of each phase with the accoring tls' number of controlled links.

Returns
Whether all tls programs are valid

Definition at line 77 of file MSTLLogicControl.cpp.

References myVariants, and WRITE_ERROR.

void MSTLLogicControl::TLSLogicVariants::executeOnSwitchActions ( ) const
std::vector< MSTrafficLightLogic * > MSTLLogicControl::TLSLogicVariants::getAllLogics ( ) const
MSTrafficLightLogic * MSTLLogicControl::TLSLogicVariants::getLogic ( const std::string &  programID) const
MSTrafficLightLogic * MSTLLogicControl::TLSLogicVariants::getLogicInstantiatingOff ( MSTLLogicControl tlc,
const std::string &  programID 
)
bool MSTLLogicControl::TLSLogicVariants::isActive ( const MSTrafficLightLogic tl) const

Definition at line 201 of file MSTLLogicControl.cpp.

References myCurrentProgram.

Referenced by GUITrafficLightLogicWrapper::getPopUpMenu().

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

Invalidated assignment operator.

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

Field Documentation

MSTrafficLightLogic* MSTLLogicControl::TLSLogicVariants::myCurrentProgram
private

The currently used program.

Definition at line 149 of file MSTLLogicControl.h.

Referenced by addLogic(), getActive(), getLogicInstantiatingOff(), isActive(), saveInitialStates(), setStateInstantiatingOnline(), and switchTo().

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

Originally loaded link states.

Definition at line 155 of file MSTLLogicControl.h.

Referenced by saveInitialStates().

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

The list of actions/commands to execute on switch.

Definition at line 158 of file MSTLLogicControl.h.

Referenced by addSwitchCommand(), executeOnSwitchActions(), and ~TLSLogicVariants().

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

A map of subkeys to programs.

Definition at line 152 of file MSTLLogicControl.h.

Referenced by addLink(), addLogic(), checkOriginalTLS(), getAllLogics(), getLogic(), getLogicInstantiatingOff(), and ~TLSLogicVariants().


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