52 const std::string
id = inputStorage.
readString();
87 tempContent.
writeInt((
int)logics.size());
103 tempContent.
writeInt(logic.currentPhaseIndex);
107 tempContent.
writeInt((
int)logic.phases.size());
138 tempContent.
writeInt((
int)links.size());
139 for (
const std::vector<libsumo::TraCILink>& sublinks : links) {
141 tempContent.
writeInt((
int)sublinks.size());
145 tempContent.
writeStringList(std::vector<std::string>({ link.from, link.to, link.via }));
170 std::string paramName =
"";
189 const std::map<std::string, std::string>& params = tls->
getMap();
191 for (std::map<std::string, std::string>::const_iterator i = params.begin(); i != params.end(); ++i) {
192 if (
"connection:" == (*i).first.substr(0, 11)) {
200 for (std::map<std::string, std::string>::const_iterator i = params.begin(); i != params.end(); ++i) {
201 if (
"connection:" != (*i).first.substr(0, 11)) {
206 std::string connection = (*i).first.substr(11);
207 std::string from, to;
208 const std::string::size_type b = connection.find(
"->");
209 if (b == std::string::npos) {
212 from = connection.substr(0, b);
213 to = connection.substr(b + 2);
215 bool denotesEdge = from.find(
"_") == std::string::npos;
218 MSTrafficLightLogic::LaneVectorVector::const_iterator j = lanes.begin();
219 for (; j != lanes.end() && fromLane == 0;) {
220 for (MSTrafficLightLogic::LaneVector::const_iterator k = (*j).begin(); k != (*j).end() && fromLane == 0;) {
221 if (denotesEdge && (*k)->getEdge().getID() == from) {
223 }
else if (!denotesEdge && (*k)->getID() == from) {
237 int pos = (int)std::distance(lanes.begin(), j);
258 std::string warning =
"";
266 const std::string
id = inputStorage.
readString();
325 for (
int j = 0; j < numPhases; ++j) {
326 int duration = 0, minDuration = 0, maxDuration = 0;
virtual const MSPhaseDefinition & getCurrentPhaseDef() const =0
Returns the definition of the current phase.
const std::string & getState() const
Returns the state within this phase.
#define CMD_GET_TL_VARIABLE
static std::string getRedYellowGreenState(const std::string &tlsID)
const LaneVectorVector & getLaneVectors() const
Returns the list of lists of all lanes controlled by this tls.
static std::vector< std::string > getControlledJunctions(const std::string &tlsID)
static void setParameter(const std::string &tlsID, const std::string ¶mName, const std::string &value)
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc2: Change Traffic Lights State)
static std::vector< std::string > getIDList()
bool readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
#define RESPONSE_GET_TL_VARIABLE
virtual void writeUnsignedByte(int)
#define TL_CONTROLLED_JUNCTIONS
static std::vector< std::string > getControlledLanes(const std::string &tlsID)
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
std::vector< TraCIPhase > phases
virtual void writeInt(int)
virtual int readUnsignedByte()
#define TL_PHASE_DURATION
static void setRedYellowGreenState(const std::string &tlsID, const std::string &state)
#define TL_CURRENT_PROGRAM
#define CMD_SET_TL_VARIABLE
#define TL_COMPLETE_PROGRAM_RYG
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
static void setPhaseDuration(const std::string &tlsID, const SUMOTime phaseDuration)
#define TL_COMPLETE_DEFINITION_RYG
virtual void writeStringList(const std::vector< std::string > &s)
#define TL_EXTERNAL_STATE
virtual std::string readString()
TraCI server used to control sumo by a remote TraCI client.
virtual void writeStorage(tcpip::Storage &store)
#define TL_CONTROLLED_LINKS
static std::vector< TraCILogic > getCompleteRedYellowGreenDefinition(const std::string &tlsID)
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
#define TL_RED_YELLOW_GREEN_STATE
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa2: Get Traffic Lights Variable)
std::vector< LaneVector > LaneVectorVector
Definition of a list that holds lists of lanes that do have the same attribute.
virtual void writeString(const std::string &s)
std::string toHex(const T i, std::streamsize numDigits=0)
const std::map< std::string, std::string > & getMap() const
Returns the inner key/value map.
static SUMOTime getNextSwitch(const std::string &tlsID)
static void setPhase(const std::string &tlsID, const int index)
static SUMOTime getPhaseDuration(const std::string &tlsID)
static void setCompleteRedYellowGreenDefinition(const std::string &tlsID, const TraCILogic &logic)
The parent class for traffic light logics.
static void setProgram(const std::string &tlsID, const std::string &programID)
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
#define TL_CONTROLLED_LANES
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
static std::string getProgram(const std::string &tlsID)
MSTrafficLightLogic * getActive() const
static int getPhase(const std::string &tlsID)
static std::string getParameter(const std::string &tlsID, const std::string ¶mName)
Representation of a lane in the micro simulation.
static std::vector< std::vector< TraCILink > > getControlledLinks(const std::string &tlsID)