 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
59 if (oc.
isSet(
"tls.half-offset")) {
65 if (oc.
isSet(
"tls.quarter-offset")) {
66 std::vector<std::string> ids = oc.
getStringVector(
"tls.quarter-offset");
80 for (Program2Def::const_iterator it_prog = programs.begin(); it_prog != programs.end(); it_prog++) {
81 idS.
avoid(it_prog->first);
143 for (Logics::iterator it = logics.begin(); it != logics.end(); it++) {
150 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
155 return std::pair<int, int>((
int)
myComputed.size(), numPrograms);
164 const std::string&
id = def->
getID();
168 if (built ==
nullptr) {
169 WRITE_WARNING(
"Could not build program '" + programID +
"' for traffic light '" +
id +
"'");
193 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
198 for (Logics::iterator it = logics.begin(); it != logics.end(); it++) {
202 for (std::set<NBTrafficLightDefinition*>::iterator it =
myExtracted.begin(); it !=
myExtracted.end(); it++) {
213 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
214 (*it)->remapRemoved(removed, incoming, outgoing);
223 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
224 (*it)->replaceRemoved(removed, removedLane, by, byLane);
234 Program2Def::const_iterator i2 = programs.find(programID);
235 if (i2 != programs.end()) {
255 Id2Logics::const_iterator i =
myComputed.find(
id);
258 Program2Logic::const_iterator i2 = programs.find(programID);
259 if (i2 != programs.end()) {
271 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
272 (*it)->setParticipantsInformation();
277 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
278 (*it)->setTLControllingInformation();
281 for (std::map<std::string, NBNode*>::const_iterator it = nc.
begin(); it != nc.
end(); it ++) {
297 for (Id2Logics::const_iterator it_id =
myComputed.begin(); it_id !=
myComputed.end(); it_id++) {
299 for (Program2Logic::const_iterator it_prog = programs.begin(); it_prog != programs.end(); it_prog++) {
300 result.push_back(it_prog->second);
312 for (Program2Def::const_iterator it_prog = programs.begin(); it_prog != programs.end(); it_prog++) {
313 result.push_back(it_prog->second);
std::map< std::string, NBTrafficLightLogic * > Program2Logic
Definition of internal the container types.
SUMOTime getDuration() const
Returns the duration of the complete cycle.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
Id2Logics myComputed
The container for previously computed tl-logics.
static const Program2Def EmptyDefinitions
NBTrafficLightLogic * compute(OptionsCont &oc)
Computes the traffic light logic.
const std::map< std::string, NBTrafficLightDefinition * > & getPrograms(const std::string &id) const
Returns all programs for the given tl-id.
#define WRITE_WARNING(msg)
bool removeProgram(const std::string id, const std::string programID, bool del=true)
Removes a program of a logic definition from the dictionary.
Storage for edges, including some functionality operating on multiple edges.
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
A traffic light logics which must be computed (only nodes/edges are given)
SumoXMLNodeType getType() const
Returns the type of this node.
std::vector< NBTrafficLightDefinition * > Definitions
Returns a list of all definitions (convenience for easier iteration)
std::set< NBTrafficLightDefinition * > myExtracted
The container for extracted definitions.
void setOffset(SUMOTime offset)
Sets the offset of this tls.
void setProgramID(const std::string &programID)
Sets the programID.
Container for nodes during the netbuilding process.
std::set< std::string > myQuarterOffsetTLS
List of tls which shall have an offset of T/2.
The representation of a single edge during network building.
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
void avoid(const std::string &id)
make sure that the given id is never supplied
NBTrafficLightDefinition * getDefinition(const std::string &id, const std::string &programID) const
Returns the named definition.
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
void extract(NBTrafficLightDefinition *definition)
Extracts a traffic light definition from myDefinitions but keeps it in myExtracted for eventual * del...
std::map< std::string, NBTrafficLightDefinition * > Program2Def
bool setCrossingTLIndices(const std::string &tlID, int startIndex)
const NBConnectionVector & getControlledLinks() const
returns the controlled links (depends on previous call to collectLinks)
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
Removes the given traffic light from this node.
std::set< std::string > myHalfOffsetTLS
List of tls which shall have an offset of T/2.
void remapRemoved(NBEdge *removed, const EdgeVector &incoming, const EdgeVector &outgoing)
Replaces occurences of the removed edge in incoming/outgoing edges of all definitions.
const std::vector< NBNode * > & getNodes() const
Returns the list of controlled nodes.
A storage for options typed value containers)
Id2Defs myDefinitions
The container for tl-ids to their definitions.
NBTrafficLightLogicCont()
Constructor.
std::vector< NBTrafficLightLogic * > getComputed() const
Returns a list of all computed logics.
std::vector< NBTrafficLightLogic * > Logics
bool removeFully(const std::string id)
Removes a logic definition (and all programs) from the dictionary.
virtual void setParticipantsInformation()
Builds the list of participating nodes/edges/links.
const std::string & getProgramID() const
Returns the ProgramID.
std::string getNext()
Returns the next id.
bool computeSingleLogic(OptionsCont &oc, NBTrafficLightDefinition *def)
Computes a specific traffic light logic (using by NETEDIT)
void setTLControllingInformation(const NBEdgeCont &ec, const NBNodeCont &nc)
Informs the edges about being controlled by a tls.
A SUMO-compliant built logic for a traffic light.
Represents a single node (junction) during network building.
~NBTrafficLightLogicCont()
Destructor.
void setTLControllingInformation() const
Informs edges about being controlled by a tls.
NBTrafficLightLogic * getLogic(const std::string &id, const std::string &programID) const
Returns the computed logic for the given name.
void clear()
Destroys all stored definitions and logics.
Definitions getDefinitions() const
std::pair< int, int > computeLogics(OptionsCont &oc)
Computes the traffic light logics using the stored definitions and stores the results.
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
const std::string & getID() const
Returns the id.
void replaceRemoved(NBEdge *removed, int removedLane, NBEdge *by, int byLane)
Replaces occurences of the removed edge/lane in all definitions by the given edge.
The base class for traffic light logic definitions.
void clearControllingTLInformation() const
Clears information about controlling traffic lights for all connenections of all edges.