46 #ifdef CHECK_MEMORY_LEAKS 48 #endif // CHECK_MEMORY_LEAKS 71 if (oc.
isSet(
"tls.half-offset")) {
77 if (oc.
isSet(
"tls.quarter-offset")) {
78 std::vector<std::string> ids = oc.
getStringVector(
"tls.quarter-offset");
92 for (Program2Def::const_iterator it_prog = programs.begin(); it_prog != programs.end(); it_prog++) {
93 idS.
avoid(it_prog->first);
155 for (Logics::iterator it = logics.begin(); it != logics.end(); it++) {
162 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
167 return std::pair<int, int>((int)
myComputed.size(), numPrograms);
173 const std::string&
id = def->
getID();
178 WRITE_WARNING(
"Could not build program '" + programID +
"' for traffic light '" +
id +
"'");
202 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
207 for (Logics::iterator it = logics.begin(); it != logics.end(); it++) {
211 for (std::set<NBTrafficLightDefinition*>::iterator it =
myExtracted.begin(); it !=
myExtracted.end(); it++) {
222 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
223 (*it)->remapRemoved(removed, incoming, outgoing);
232 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
233 (*it)->replaceRemoved(removed, removedLane, by, byLane);
243 Program2Def::const_iterator i2 = programs.find(programID);
244 if (i2 != programs.end()) {
264 Id2Logics::const_iterator i =
myComputed.find(
id);
267 Program2Logic::const_iterator i2 = programs.find(programID);
268 if (i2 != programs.end()) {
280 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
281 (*it)->setParticipantsInformation();
286 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
287 (*it)->setTLControllingInformation();
290 for (std::map<std::string, NBNode*>::const_iterator it = nc.
begin(); it != nc.
end(); it ++) {
295 dummy.setTLControllingInformation();
305 for (Id2Logics::const_iterator it_id =
myComputed.begin(); it_id !=
myComputed.end(); it_id++) {
307 for (Program2Logic::const_iterator it_prog = programs.begin(); it_prog != programs.end(); it_prog++) {
308 result.push_back(it_prog->second);
320 for (Program2Def::const_iterator it_prog = programs.begin(); it_prog != programs.end(); it_prog++) {
321 result.push_back(it_prog->second);
std::map< std::string, NBTrafficLightLogic * > Program2Logic
Definition of internal the container types.
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
bool removeProgram(const std::string id, const std::string programID, bool del=true)
Removes a program of a logic definition from the dictionary.
static const Program2Def EmptyDefinitions
A SUMO-compliant built logic for a traffic light.
const std::string & getProgramID() const
Returns the ProgramID.
The representation of a single edge during network building.
NBTrafficLightLogic * compute(OptionsCont &oc)
Computes the traffic light logic.
void avoid(const std::string &id)
make sure that the given id is never supplied
The base class for traffic light logic definitions.
void setOffset(SUMOTime offset)
Sets the offset of this tls.
std::vector< NBTrafficLightDefinition * > Definitions
void clearControllingTLInformation() const
Clears information about controlling traffic lights for all connenections of all edges.
Definitions getDefinitions() const
Returns a list of all definitions (convenience for easier iteration)
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
Removes the given traffic light from this node.
void extract(NBTrafficLightDefinition *definition)
Extracts a traffic light definition from myDefinitions but keeps it in myExtracted for eventual * del...
#define WRITE_WARNING(msg)
std::set< NBTrafficLightDefinition * > myExtracted
The container for extracted definitions.
NBTrafficLightDefinition * getDefinition(const std::string &id, const std::string &programID) const
Returns the named definition.
std::set< std::string > myQuarterOffsetTLS
List of tls which shall have an offset of T/2.
const std::string & getID() const
Returns the id.
std::map< std::string, NBTrafficLightDefinition * > Program2Def
std::string getNext()
Returns the next id.
void remapRemoved(NBEdge *removed, const EdgeVector &incoming, const EdgeVector &outgoing)
Replaces occurences of the removed edge in incoming/outgoing edges of all definitions.
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
std::set< std::string > myHalfOffsetTLS
List of tls which shall have an offset of T/2.
SumoXMLNodeType getType() const
Returns the type of this node.
const std::map< std::string, NBTrafficLightDefinition * > & getPrograms(const std::string &id) const
Returns all programs for the given tl-id.
Storage for edges, including some functionality operating on multiple edges.
std::vector< NBTrafficLightLogic * > getComputed() const
Returns a list of all computed logics.
void setProgramID(const std::string &programID)
Sets the programID.
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
SUMOTime getDuration() const
Returns the duration of the complete cycle.
std::vector< NBTrafficLightLogic * > Logics
NBTrafficLightLogicCont()
Constructor.
Id2Defs myDefinitions
The container for tl-ids to their definitions.
NBTrafficLightLogic * getLogic(const std::string &id, const std::string &programID) const
Returns the computed logic for the given name.
bool computeSingleLogic(OptionsCont &oc, NBTrafficLightDefinition *def)
Computes a specific traffic light logic (using by NETEDIT)
std::vector< NBEdge * > EdgeVector
A storage for options typed value containers)
Represents a single node (junction) during network building.
bool removeFully(const std::string id)
Removes a logic definition (and all programs) from the dictionary.
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
void clear()
Destroys all stored definitions and logics.
Container for nodes during the netbuilding process.
void replaceRemoved(NBEdge *removed, int removedLane, NBEdge *by, int byLane)
Replaces occurences of the removed edge/lane in all definitions by the given edge.
A traffic light logics which must be computed (only nodes/edges are given)
void setParticipantsInformation()
Builds the list of participating nodes/edges/links.
void setTLControllingInformation(const NBEdgeCont &ec, const NBNodeCont &nc)
Informs the edges about being controlled by a tls.
Id2Logics myComputed
The container for previously computed tl-logics.
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
std::pair< int, int > computeLogics(OptionsCont &oc)
Computes the traffic light logics using the stored definitions and stores the results.
~NBTrafficLightLogicCont()
Destructor.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.