 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
60 if (oc.
isSet(
"tls.half-offset")) {
66 if (oc.
isSet(
"tls.quarter-offset")) {
67 std::vector<std::string> ids = oc.
getStringVector(
"tls.quarter-offset");
81 for (Program2Def::const_iterator it_prog = programs.begin(); it_prog != programs.end(); it_prog++) {
82 idS.
avoid(it_prog->first);
144 for (Logics::iterator it = logics.begin(); it != logics.end(); it++) {
151 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
156 return std::pair<int, int>((
int)
myComputed.size(), numPrograms);
165 const std::string&
id = def->
getID();
169 if (built ==
nullptr) {
170 WRITE_WARNING(
"Could not build program '" + programID +
"' for traffic light '" +
id +
"'");
194 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
199 for (Logics::iterator it = logics.begin(); it != logics.end(); it++) {
203 for (std::set<NBTrafficLightDefinition*>::iterator it =
myExtracted.begin(); it !=
myExtracted.end(); it++) {
214 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
215 (*it)->remapRemoved(removed, incoming, outgoing);
224 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
225 (*it)->replaceRemoved(removed, removedLane, by, byLane);
235 Program2Def::const_iterator i2 = programs.find(programID);
236 if (i2 != programs.end()) {
256 Id2Logics::const_iterator i =
myComputed.find(
id);
259 Program2Logic::const_iterator i2 = programs.find(programID);
260 if (i2 != programs.end()) {
272 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
273 (*it)->setParticipantsInformation();
278 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
279 (*it)->setTLControllingInformation();
282 for (std::map<std::string, NBNode*>::const_iterator it = nc.
begin(); it != nc.
end(); it ++) {
287 dummy.setTLControllingInformation();
298 for (Id2Logics::const_iterator it_id =
myComputed.begin(); it_id !=
myComputed.end(); it_id++) {
300 for (Program2Logic::const_iterator it_prog = programs.begin(); it_prog != programs.end(); it_prog++) {
301 result.push_back(it_prog->second);
313 for (Program2Def::const_iterator it_prog = programs.begin(); it_prog != programs.end(); it_prog++) {
314 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.
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)
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.
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.
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 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.