67 if (oc.
isSet(
"tls.half-offset")) {
73 if (oc.
isSet(
"tls.quarter-offset")) {
74 std::vector<std::string> ids = oc.
getStringVector(
"tls.quarter-offset");
88 for (Program2Def::const_iterator it_prog = programs.begin(); it_prog != programs.end(); it_prog++) {
89 idS.
avoid(it_prog->first);
151 for (Logics::iterator it = logics.begin(); it != logics.end(); it++) {
158 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
163 return std::pair<int, int>((int)
myComputed.size(), numPrograms);
172 const std::string&
id = def->
getID();
177 WRITE_WARNING(
"Could not build program '" + programID +
"' for traffic light '" +
id +
"'");
201 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
206 for (Logics::iterator it = logics.begin(); it != logics.end(); it++) {
210 for (std::set<NBTrafficLightDefinition*>::iterator it =
myExtracted.begin(); it !=
myExtracted.end(); it++) {
221 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
222 (*it)->remapRemoved(removed, incoming, outgoing);
231 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
232 (*it)->replaceRemoved(removed, removedLane, by, byLane);
242 Program2Def::const_iterator i2 = programs.find(programID);
243 if (i2 != programs.end()) {
263 Id2Logics::const_iterator i =
myComputed.find(
id);
266 Program2Logic::const_iterator i2 = programs.find(programID);
267 if (i2 != programs.end()) {
279 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
280 (*it)->setParticipantsInformation();
285 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
286 (*it)->setTLControllingInformation();
289 for (std::map<std::string, NBNode*>::const_iterator it = nc.
begin(); it != nc.
end(); it ++) {
294 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);
const std::map< std::string, NBTrafficLightDefinition * > & getPrograms(const std::string &id) const
Returns all programs for the given tl-id.
std::map< std::string, NBTrafficLightLogic * > Program2Logic
Definition of internal the container types.
bool removeProgram(const std::string id, const std::string programID, bool del=true)
Removes a program of a logic definition from the dictionary.
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
static const Program2Def EmptyDefinitions
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
A SUMO-compliant built logic for a traffic light.
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
const std::string & getID() const
Returns the id.
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.
std::set< std::string > myQuarterOffsetTLS
List of tls which shall have an offset of T/2.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
std::map< std::string, NBTrafficLightDefinition * > Program2Def
std::string getNext()
Returns the next id.
NBTrafficLightDefinition * getDefinition(const std::string &id, const std::string &programID) const
Returns the named definition.
void remapRemoved(NBEdge *removed, const EdgeVector &incoming, const EdgeVector &outgoing)
Replaces occurences of the removed edge in incoming/outgoing edges of all definitions.
void setCrossingTLIndices(const std::string &tlID, int startIndex)
set tl indices of this nodes crossing starting at the given index
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.
void clearControllingTLInformation() const
Clears information about controlling traffic lights for all connenections of all edges.
Storage for edges, including some functionality operating on multiple edges.
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) ...
void setProgramID(const std::string &programID)
Sets the programID.
const std::string & getProgramID() const
Returns the ProgramID.
std::vector< NBTrafficLightLogic * > Logics
SUMOTime getDuration() const
Returns the duration of the complete cycle.
NBTrafficLightLogicCont()
Constructor.
Id2Defs myDefinitions
The container for tl-ids to their definitions.
std::vector< NBTrafficLightLogic * > getComputed() const
Returns a list of all computed logics.
bool computeSingleLogic(OptionsCont &oc, NBTrafficLightDefinition *def)
Computes a specific traffic light logic (using by NETEDIT)
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
const std::vector< NBNode * > & getNodes() const
Returns the list of controlled nodes.
A storage for options typed value containers)
SumoXMLNodeType getType() const
Returns the type of this node.
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)
NBTrafficLightLogic * getLogic(const std::string &id, const std::string &programID) const
Returns the computed logic for the given name.
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::pair< int, int > computeLogics(OptionsCont &oc)
Computes the traffic light logics using the stored definitions and stores the results.
Definitions getDefinitions() const
Returns a list of all definitions (convenience for easier iteration)
~NBTrafficLightLogicCont()
Destructor.