 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
20 #ifndef MSPhaseDefinition_h
21 #define MSPhaseDefinition_h
24 #define TRANSIENT_NOTDECISIONAL_BIT 1
26 #define UNDEFINED_BIT 3
110 const std::vector<int> nextPhasesArg,
const std::string& nameArg) {
111 this->duration = durationArg;
112 this->state = stateArg;
113 this->minDuration = minDurationArg < 0 ? durationArg : minDurationArg;
114 this->maxDuration = (maxDurationArg < 0 || maxDurationArg < minDurationArg) ? durationArg : maxDurationArg;
119 this->nextPhases = nextPhasesArg;
120 this->name = nameArg;
124 const std::vector<int>& nextPhasesArg,
const std::string& nameArg,
LaneIdVector* targetLaneSetArg) {
125 init(durationArg, stateArg, minDurationArg, maxDurationArg, nextPhasesArg, nameArg);
127 if (targetLaneSetArg !=
nullptr) {
128 this->targetLaneSet = *targetLaneSetArg;
160 const std::vector<int>&
nextPhases = std::vector<int>(),
const std::string&
name =
"") {
178 const std::vector<int>&
nextPhases,
const std::string&
name,
bool transient_notdecisional,
bool commit,
LaneIdVector* targetLaneSetArg =
nullptr) {
179 if (targetLaneSetArg !=
nullptr && targetLaneSetArg->size() == 0) {
189 init(durationArg, minDurationArg, maxDurationArg, stateArg,
nextPhases,
name, targetLaneSetArg);
231 if (
state.find_first_of(
"gG") == std::string::npos) {
234 if (
state.find_first_of(
"yY") != std::string::npos) {
void init(SUMOTime durationArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::string &stateArg, const std::vector< int > &nextPhasesArg, const std::string &nameArg, LaneIdVector *targetLaneSetArg)
#define TRANSIENT_NOTDECISIONAL_BIT
SUMOTime myLastSwitch
Stores the timestep of the last on-switched of the phase.
std::string state
The phase definition.
MSPhaseDefinition(SUMOTime durationArg, const std::string &stateArg, SUMOTime minDurationArg=-1, SUMOTime maxDurationArg=-1, const std::vector< int > &nextPhases=std::vector< int >(), const std::string &name="")
Constructor In this phase the duration is constrained between min and max duration.
virtual ~MSPhaseDefinition()
Destructor.
SUMOTime lastDuration
The previous duration of the phase.
std::vector< int > nextPhases
The index of the phase that suceeds this one (or -1)
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
static OptionsCont & getOptions()
Retrieves the options.
std::bitset< 4 > PhaseType
std::vector< std::string > LaneIdVector
const std::vector< int > & getNextPhases() const
SUMOTime maxDuration
The maximum duration of the phase.
void setState(const std::string &_state)
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
bool isDecisional() const
SUMOTime duration
The duration of the phase.
const std::string & getState() const
Returns the state within this phase.
bool isGreenPhase() const
Returns whether this phase is a pure "green" phase.
MSPhaseDefinition(SUMOTime durationArg, const std::string &stateArg, const std::vector< int > &nextPhases, const std::string &name="")
Constructor.
const LaneIdVector & getTargetLaneSet() const
LinkState getSignalState(int pos) const
Returns the state of the tls signal at the given position.
SUMOTime string2time(const std::string &r)
LaneIdVector targetLaneSet
MSPhaseDefinition(SUMOTime durationArg, const std::string &stateArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::vector< int > &nextPhases, const std::string &name, bool transient_notdecisional, bool commit, LaneIdVector *targetLaneSetArg=nullptr)
std::string name
Optional name or description for the current phase.
void setName(const std::string &_name)
void init(SUMOTime durationArg, const std::string &stateArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::vector< int > nextPhasesArg, const std::string &nameArg)
bool operator!=(const MSPhaseDefinition &pd)
Comparison operator.
The definition of a single phase of a tls logic.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
SUMOTime minDuration
The minimum duration of the phase.
const std::string & getName() const