27 #define TRANSIENT_NOTDECISIONAL_BIT 1
29 #define UNDEFINED_BIT 3
107 const std::vector<int> nextPhasesArg,
const std::string& nameArg) {
108 this->duration = durationArg;
109 this->state = stateArg;
110 this->minDuration = minDurationArg < 0 ? durationArg : minDurationArg;
111 this->maxDuration = (maxDurationArg < 0 || maxDurationArg < minDurationArg) ? durationArg : maxDurationArg;
116 this->nextPhases = nextPhasesArg;
117 this->name = nameArg;
121 const std::vector<int>& nextPhasesArg,
const std::string& nameArg,
LaneIdVector* targetLaneSetArg) {
122 init(durationArg, stateArg, minDurationArg, maxDurationArg, nextPhasesArg, nameArg);
124 if (targetLaneSetArg !=
nullptr) {
125 this->targetLaneSet = *targetLaneSetArg;
157 const std::vector<int>&
nextPhases = std::vector<int>(),
const std::string&
name =
"") {
175 const std::vector<int>&
nextPhases,
const std::string&
name,
bool transient_notdecisional,
bool commit,
LaneIdVector* targetLaneSetArg =
nullptr) {
176 if (targetLaneSetArg !=
nullptr && targetLaneSetArg->size() == 0) {
186 init(durationArg, minDurationArg, maxDurationArg, stateArg,
nextPhases,
name, targetLaneSetArg);
228 if (
state.find_first_of(
"gG") == std::string::npos) {
231 if (
state.find_first_of(
"yY") != std::string::npos) {
#define TRANSIENT_NOTDECISIONAL_BIT
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
The definition of a single phase of a tls logic.
const std::string & getState() const
Returns the state within this phase.
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.
SUMOTime lastDuration
The previous duration of the phase.
SUMOTime maxDuration
The maximum duration of the phase.
LinkState getSignalState(int pos) const
Returns the state of the tls signal at the given position.
std::bitset< 4 > PhaseType
std::vector< std::string > LaneIdVector
void init(SUMOTime durationArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::string &stateArg, const std::vector< int > &nextPhasesArg, const std::string &nameArg, LaneIdVector *targetLaneSetArg)
virtual ~MSPhaseDefinition()
Destructor.
const std::vector< int > & getNextPhases() const
SUMOTime minDuration
The minimum duration of the phase.
LaneIdVector targetLaneSet
SUMOTime myLastSwitch
Stores the timestep of the last on-switched of the phase.
std::string state
The phase definition.
SUMOTime duration
The duration of the phase.
bool isGreenPhase() const
Returns whether this phase is a pure "green" phase.
const LaneIdVector & getTargetLaneSet() const
const std::string & getName() const
bool isDecisional() const
std::vector< int > nextPhases
The index of the phase that suceeds this one (or -1)
void init(SUMOTime durationArg, const std::string &stateArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::vector< int > nextPhasesArg, const std::string &nameArg)
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.
void setState(const std::string &_state)
MSPhaseDefinition(SUMOTime durationArg, const std::string &stateArg, const std::vector< int > &nextPhases, const std::string &name="")
Constructor.
void setName(const std::string &_name)
bool operator!=(const MSPhaseDefinition &pd)
Comparison operator.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
static OptionsCont & getOptions()
Retrieves the options.