21 #ifndef MSPhaseDefinition_h 22 #define MSPhaseDefinition_h 25 #define TRANSIENT_NOTDECISIONAL_BIT 1 27 #define UNDEFINED_BIT 3 105 this->duration = durationArg;
106 this->minDuration = minDurationArg < 0 ? durationArg : minDurationArg;
107 this->maxDuration = (maxDurationArg < 0 || maxDurationArg < minDurationArg) ? durationArg : maxDurationArg;
109 this->state = stateArg;
116 init(durationArg, minDurationArg, maxDurationArg, stateArg);
118 this->targetLaneSet = targetLaneSetArg;
137 init(durationArg, durationArg, durationArg, stateArg);
155 init(durationArg, minDurationArg, maxDurationArg, stateArg);
166 MSPhaseDefinition(
SUMOTime durationArg,
const std::string& stateArg,
bool transient_notdecisional,
bool commit, LaneIdVector& targetLaneSetArg) {
167 if (targetLaneSetArg.size() == 0) {
176 init(durationArg, durationArg, durationArg, stateArg, targetLaneSetArg);
191 init(durationArg, durationArg, durationArg, stateArg);
203 if (targetLaneSetArg.size() == 0) {
213 init(durationArg, minDurationArg, maxDurationArg, stateArg, targetLaneSetArg);
229 init(durationArg, minDurationArg, maxDurationArg, stateArg);
261 if (state.find_first_of(
"gG") == std::string::npos) {
264 if (state.find_first_of(
"yY") != std::string::npos) {
287 return state != pd.
state;
MSPhaseDefinition(SUMOTime durationArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::string &stateArg, bool transient_notdecisional, bool commit, LaneIdVector &targetLaneSetArg)
const std::string & getState() const
Returns the state within this phase.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
#define TRANSIENT_NOTDECISIONAL_BIT
LaneIdVector targetLaneSet
std::bitset< 4 > PhaseType
LinkState getSignalState(int pos) const
Returns the state of the tls signal at the given position.
MSPhaseDefinition(SUMOTime durationArg, const std::string &stateArg)
Constructor.
static OptionsCont & getOptions()
Retrieves the options.
MSPhaseDefinition(SUMOTime durationArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::string &stateArg)
Constructor In this phase the duration is constrained between min and max duration.
SUMOTime duration
The duration of the phase.
void init(SUMOTime durationArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::string &stateArg, LaneIdVector &targetLaneSetArg)
void setState(const std::string &_state)
SUMOTime myLastSwitch
Stores the timestep of the last on-switched of the phase.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
SUMOTime string2time(const std::string &r)
MSPhaseDefinition(SUMOTime durationArg, const std::string &stateArg, bool transient_notdecisional, bool commit)
SUMOTime lastDuration
The previous duration of the phase.
std::string state
The phase definition.
void init(SUMOTime durationArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::string &stateArg)
SUMOTime maxDuration
The maximum duration of the phase.
std::vector< std::string > LaneIdVector
MSPhaseDefinition(SUMOTime durationArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::string &stateArg, bool transient_notdecisional, bool commit)
void inform(std::string msg, bool addType=true)
adds a new error to the list
bool operator!=(const MSPhaseDefinition &pd)
Comparison operator.
SUMOTime minDuration
The minimum duration of the phase.
MSPhaseDefinition(SUMOTime durationArg, const std::string &stateArg, bool transient_notdecisional, bool commit, LaneIdVector &targetLaneSetArg)
bool isGreenPhase() const
Returns whether this phase is a pure "green" phase.
virtual ~MSPhaseDefinition()
Destructor.
const LaneIdVector & getTargetLaneSet() const
The definition of a single phase of a tls logic.
bool isDecisional() const