23 #ifndef MSPhaseDefinition_h 24 #define MSPhaseDefinition_h 27 #define TRANSIENT_NOTDECISIONAL_BIT 1 29 #define UNDEFINED_BIT 3 111 this->duration = durationArg;
112 this->minDuration = minDurationArg < 0 ? durationArg : minDurationArg;
113 this->maxDuration = (maxDurationArg < 0 || maxDurationArg < minDurationArg) ? durationArg : maxDurationArg;
115 this->state = stateArg;
122 init(durationArg, minDurationArg, maxDurationArg, stateArg);
124 this->targetLaneSet = targetLaneSetArg;
143 init(durationArg, durationArg, durationArg, stateArg);
161 init(durationArg, minDurationArg, maxDurationArg, stateArg);
172 MSPhaseDefinition(
SUMOTime durationArg,
const std::string& stateArg,
bool transient_notdecisional,
bool commit, LaneIdVector& targetLaneSetArg)
throw() {
173 if (targetLaneSetArg.size() == 0) {
182 init(durationArg, durationArg, durationArg, stateArg, targetLaneSetArg);
197 init(durationArg, durationArg, durationArg, stateArg);
209 if (targetLaneSetArg.size() == 0) {
219 init(durationArg, minDurationArg, maxDurationArg, stateArg, targetLaneSetArg);
235 init(durationArg, minDurationArg, maxDurationArg, stateArg);
263 if (state.find_first_of(
"gG") == std::string::npos) {
266 if (state.find_first_of(
"yY") != std::string::npos) {
289 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)
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