40 #ifdef CHECK_MEMORY_LEAKS
42 #endif // CHECK_MEMORY_LEAKS
90 std::vector<MSTrafficLightLogic*> logics = vars.
getAllLogics();
95 tempContent.
writeInt((
int) logics.size());
97 for (
unsigned int i = 0; i < logics.size(); ++i) {
117 tempContent.
writeInt((
int) phaseNo);
119 for (
unsigned int j = 0; j < phaseNo; ++j) {
130 const std::string& state = phase.
getState();
144 std::vector<std::string> laneIDs;
145 for (MSTrafficLightLogic::LaneVectorVector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
147 for (MSTrafficLightLogic::LaneVector::const_iterator j = llanes.begin(); j != llanes.end(); ++j) {
148 laneIDs.push_back((*j)->getID());
160 unsigned int cnt = 0;
162 unsigned int no = (
unsigned int) lanes.size();
164 for (
unsigned int i = 0; i < no; ++i) {
169 unsigned int no2 = (
unsigned int) llanes.size();
172 for (
unsigned int j = 0; j < no2; ++j) {
174 std::vector<std::string> def;
176 def.push_back(llanes[j]->getID());
180 #ifdef HAVE_INTERNAL_LANES
181 def.push_back(link->getViaLane() != 0 ? link->getViaLane()->getID() :
"");
226 std::string warning =
"";
286 int type = 0, index = 0, phaseNo = 0;
307 if (index >= phaseNo) {
311 std::vector<MSPhaseDefinition*> phases;
312 for (
int j = 0; j < phaseNo; ++j) {
313 int duration = 0, minDuration = 0, maxDuration = 0;
328 phases.push_back(phase);
332 vars.
addLogic(subid, logic,
true,
true);
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
virtual unsigned int getCurrentPhaseIndex() const =0
Returns the current index within the program.
Storage for all programs of a single tls.
virtual const MSPhaseDefinition & getPhase(unsigned int givenstep) const =0
Returns the definition of the phase from the given position within the plan.
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.
std::vector< std::string > getAllTLIds() const
#define RESPONSE_GET_TL_VARIABLE
virtual void writeUnsignedByte(int)
#define TL_CONTROLLED_JUNCTIONS
SUMOTime getCurrentTimeStep() const
Returns the current simulation step (in s)
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
MSTrafficLightLogic * getLogic(const std::string &programID) const
virtual void writeInt(int)
A fixed traffic light logic.
virtual int readUnsignedByte()
#define TL_PHASE_DURATION
#define TL_CURRENT_PROGRAM
virtual void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, unsigned int step, SUMOTime stepDuration)=0
Changes the current phase and her duration.
SUMOTime getNextSwitchTime() const
Returns the assumed next switch time.
#define CMD_SET_TL_VARIABLE
A class that stores and controls tls and switching of their programs.
std::vector< MSTrafficLightLogic * > getAllLogics() const
const std::string & getID() const
Returns the id.
SUMOTime duration
The duration of the phase.
bool addLogic(const std::string &programID, MSTrafficLightLogic *logic, bool netWasLoaded, bool isNewDefault=true)
Adds a logic (program)
std::vector< LinkVector > LinkVectorVector
Definition of a list that holds lists of links that do have the same attribute.
MSTrafficLightLogic * getActive() const
#define TL_COMPLETE_PROGRAM_RYG
MSLane * getLane() const
Returns the connected lane.
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
#define TL_COMPLETE_DEFINITION_RYG
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
virtual void writeStringList(const std::vector< std::string > &s)
virtual std::string readString()
TraCI server used to control sumo by a remote TraCI client.
void setStateInstantiatingOnline(MSTLLogicControl &tlc, const std::string &state)
bool knows(const std::string &id) const
Returns the information whether the named tls is stored.
virtual void writeStorage(tcpip::Storage &store)
#define TL_CONTROLLED_LINKS
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
#define TL_RED_YELLOW_GREEN_STATE
std::vector< MSLink * > LinkVector
Definition of the list of links that participate in this tl-light.
const LaneVectorVector & getLanes() const
Returns the list of lists of all lanes controlled by this tls.
void switchTo(MSTLLogicControl &tlc, const std::string &programID)
std::vector< MSLane * > LaneVector
Definition of the list of links that participate in this tl-light.
std::vector< LaneVector > LaneVectorVector
Definition of a list that holds lists of links that do have the same attribute.
virtual void writeString(const std::string &s)
SUMOTime maxDuration
The maximum duration of the phase.
virtual unsigned int getPhaseNumber() const =0
Returns the number of phases.
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
SUMOTime minDuration
The minimum duration of the phase.
The parent class for traffic light logics.
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc2: Change Traffic Lights State)
const std::string & getProgramID() const
Returns this tl-logic's id.
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
The definition of a single phase of a tls logic.
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa2: Get Traffic Lights Variable)