SUMO - Simulation of Urban MObility
MSPhaseDefinition Class Reference

The definition of a single phase of a tls logic. More...

#include <MSPhaseDefinition.h>

Collaboration diagram for MSPhaseDefinition:
Collaboration graph

Public Types

typedef std::vector< std::string > LaneIdVector
 
typedef std::bitset< 4 > PhaseType
 

Public Member Functions

LinkState getSignalState (int pos) const
 Returns the state of the tls signal at the given position. More...
 
const std::string & getState () const
 Returns the state within this phase. More...
 
const LaneIdVectorgetTargetLaneSet () const throw ()
 
bool isCommit () const throw ()
 
bool isDecisional () const throw ()
 
bool isGreenPhase () const
 Returns whether this phase is a pure "green" phase. More...
 
bool isTarget () const throw ()
 
bool isTransient () const throw ()
 
bool isUndefined () const throw ()
 
 MSPhaseDefinition (SUMOTime durationArg, const std::string &stateArg)
 Constructor. More...
 
 MSPhaseDefinition (SUMOTime durationArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::string &stateArg) throw ()
 Constructor In this phase the duration is constrained between min and max duration. More...
 
 MSPhaseDefinition (SUMOTime durationArg, const std::string &stateArg, bool transient_notdecisional, bool commit, LaneIdVector &targetLaneSetArg) throw ()
 
 MSPhaseDefinition (SUMOTime durationArg, const std::string &stateArg, bool transient_notdecisional, bool commit) throw ()
 
 MSPhaseDefinition (SUMOTime durationArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::string &stateArg, bool transient_notdecisional, bool commit, LaneIdVector &targetLaneSetArg) throw ()
 
 MSPhaseDefinition (SUMOTime durationArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::string &stateArg, bool transient_notdecisional, bool commit) throw ()
 
bool operator!= (const MSPhaseDefinition &pd)
 Comparison operator. More...
 
virtual ~MSPhaseDefinition ()
 Destructor. More...
 

Data Fields

SUMOTime duration
 The duration of the phase. More...
 
SUMOTime lastDuration
 The previous duration of the phase. More...
 
SUMOTime maxDuration
 The maximum duration of the phase. More...
 
SUMOTime minDuration
 The minimum duration of the phase. More...
 
SUMOTime myLastSwitch
 Stores the timestep of the last on-switched of the phase. More...
 

Private Member Functions

void init (SUMOTime durationArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::string &stateArg)
 
void init (SUMOTime durationArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::string &stateArg, LaneIdVector &targetLaneSetArg)
 

Private Attributes

PhaseType phaseType
 
std::string state
 The phase definition. More...
 
LaneIdVector targetLaneSet
 

Detailed Description

The definition of a single phase of a tls logic.

Definition at line 59 of file MSPhaseDefinition.h.

Member Typedef Documentation

typedef std::vector<std::string> MSPhaseDefinition::LaneIdVector

Definition at line 74 of file MSPhaseDefinition.h.

typedef std::bitset<4> MSPhaseDefinition::PhaseType

Definition at line 72 of file MSPhaseDefinition.h.

Constructor & Destructor Documentation

MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
const std::string &  stateArg 
)
inline

Constructor.

minDuration and maxDuration are set to duration.

Parameters
[in]durationArgThe duration of the phase
[in]stateArgThe state in the phase

Definition at line 136 of file MSPhaseDefinition.h.

References COMMIT_BIT, init(), TARGET_BIT, TRANSIENT_NOTDECISIONAL_BIT, and UNDEFINED_BIT.

MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
SUMOTime  minDurationArg,
SUMOTime  maxDurationArg,
const std::string &  stateArg 
)
throw (
)
inline

Constructor In this phase the duration is constrained between min and max duration.

Parameters
[in]durationArgThe duration of the phase
[in]minDurationArgThe minimum duration of the phase
[in]maxDurationArgThe maximum duration of the phase
[in]stateArgThe state in the phase

Definition at line 154 of file MSPhaseDefinition.h.

References COMMIT_BIT, init(), TARGET_BIT, TRANSIENT_NOTDECISIONAL_BIT, and UNDEFINED_BIT.

MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
const std::string &  stateArg,
bool  transient_notdecisional,
bool  commit,
LaneIdVector targetLaneSetArg 
)
throw (
)
inline
MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
const std::string &  stateArg,
bool  transient_notdecisional,
bool  commit 
)
throw (
)
inline
MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
SUMOTime  minDurationArg,
SUMOTime  maxDurationArg,
const std::string &  stateArg,
bool  transient_notdecisional,
bool  commit,
LaneIdVector targetLaneSetArg 
)
throw (
)
inline
MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
SUMOTime  minDurationArg,
SUMOTime  maxDurationArg,
const std::string &  stateArg,
bool  transient_notdecisional,
bool  commit 
)
throw (
)
inline
virtual MSPhaseDefinition::~MSPhaseDefinition ( )
inlinevirtual

Destructor.

Definition at line 241 of file MSPhaseDefinition.h.

Member Function Documentation

LinkState MSPhaseDefinition::getSignalState ( int  pos) const
inline

Returns the state of the tls signal at the given position.

Parameters
[in]posThe position of the signal to return the state for
Returns
The state of the signal at the given position

Definition at line 277 of file MSPhaseDefinition.h.

const LaneIdVector& MSPhaseDefinition::getTargetLaneSet ( ) const
throw (
)
inline
void MSPhaseDefinition::init ( SUMOTime  durationArg,
SUMOTime  minDurationArg,
SUMOTime  maxDurationArg,
const std::string &  stateArg 
)
inlineprivate

Definition at line 111 of file MSPhaseDefinition.h.

References OptionsCont::getOptions(), and string2time().

Referenced by init(), and MSPhaseDefinition().

void MSPhaseDefinition::init ( SUMOTime  durationArg,
SUMOTime  minDurationArg,
SUMOTime  maxDurationArg,
const std::string &  stateArg,
LaneIdVector targetLaneSetArg 
)
inlineprivate

Definition at line 121 of file MSPhaseDefinition.h.

References init().

bool MSPhaseDefinition::isDecisional ( ) const
throw (
)
inline
bool MSPhaseDefinition::isGreenPhase ( ) const
inline

Returns whether this phase is a pure "green" phase.

"pure green" means in this case that at least one stream has green and no stream has yellow. Such phases are meant to be candidates for being stretched by actuated or agentbased traffic light logics.

Returns
Whether this phase is a "pure green" phase

Definition at line 262 of file MSPhaseDefinition.h.

bool MSPhaseDefinition::isTransient ( ) const
throw (
)
inline
bool MSPhaseDefinition::isUndefined ( ) const
throw (
)
inline

Definition at line 296 of file MSPhaseDefinition.h.

References UNDEFINED_BIT.

Referenced by MSSOTLTrafficLightLogic::checkPhases().

bool MSPhaseDefinition::operator!= ( const MSPhaseDefinition pd)
inline

Comparison operator.

Note that only the state must differ, not the duration!

Parameters
[in]pdThe phase definition to compare against
Returns
Whether the given phase definition differs

Definition at line 288 of file MSPhaseDefinition.h.

References state.

Field Documentation

SUMOTime MSPhaseDefinition::lastDuration

The previous duration of the phase.

Definition at line 81 of file MSPhaseDefinition.h.

Referenced by MSSOTLWaveTrafficLightLogic::canRelease().

SUMOTime MSPhaseDefinition::maxDuration

The maximum duration of the phase.

Definition at line 87 of file MSPhaseDefinition.h.

Referenced by MSSOTLPlatoonPolicy::canRelease(), and TraCIServerAPI_TLS::processGet().

SUMOTime MSPhaseDefinition::myLastSwitch
PhaseType MSPhaseDefinition::phaseType
private

Definition at line 99 of file MSPhaseDefinition.h.

std::string MSPhaseDefinition::state
private

The phase definition.

Definition at line 94 of file MSPhaseDefinition.h.

Referenced by getState(), and operator!=().

LaneIdVector MSPhaseDefinition::targetLaneSet
private

Definition at line 109 of file MSPhaseDefinition.h.

Referenced by getTargetLaneSet().


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