24 #ifndef MSPhaseDefinition_h 25 #define MSPhaseDefinition_h 28 #define TRANSIENT_NOTDECISIONAL_BIT 1 30 #define UNDEFINED_BIT 3 112 this->duration = durationArg;
113 this->minDuration = minDurationArg < 0 ? durationArg : minDurationArg;
114 this->maxDuration = (maxDurationArg < 0 || maxDurationArg < minDurationArg) ? durationArg : maxDurationArg;
116 this->state = stateArg;
123 init(durationArg, minDurationArg, maxDurationArg, stateArg);
125 this->targetLaneSet = targetLaneSetArg;
144 init(durationArg, durationArg, durationArg, stateArg);
162 init(durationArg, minDurationArg, maxDurationArg, stateArg);
173 MSPhaseDefinition(
SUMOTime durationArg,
const std::string& stateArg,
bool transient_notdecisional,
bool commit, LaneIdVector& targetLaneSetArg)
throw() {
174 if (targetLaneSetArg.size() == 0) {
183 init(durationArg, durationArg, durationArg, stateArg, targetLaneSetArg);
198 init(durationArg, durationArg, durationArg, stateArg);
210 if (targetLaneSetArg.size() == 0) {
220 init(durationArg, minDurationArg, maxDurationArg, stateArg, targetLaneSetArg);
236 init(durationArg, minDurationArg, maxDurationArg, stateArg);
264 if (state.find_first_of(
"gG") == std::string::npos) {
267 if (state.find_first_of(
"yY") != std::string::npos) {
290 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