Eclipse SUMO - Simulation of Urban MObility
NIXMLTrafficLightsHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // Importer for traffic lights stored in XML
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
24 #include <netbuild/NBConnection.h>
25 
26 
27 // ===========================================================================
28 // class declarations
29 // ===========================================================================
30 class NBEdge;
31 class NBEdgeCont;
32 class MsgHandler;
33 class NBLoadedSUMOTLDef;
35 
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
48 public:
52  NIXMLTrafficLightsHandler(NBTrafficLightLogicCont& tlCont, NBEdgeCont& ec, bool ignoreUnknown = false);
53 
54 
57 
58  const std::set<std::string>& getSeenIDs() {
59  return mySeenIDs;
60  }
61 
62 
63 protected:
65 
66 
74  void myStartElement(int element, const SUMOSAXAttributes& attrs);
75 
76 
83  void myEndElement(int element);
85 
86 
87 
88 private:
91 
94 
97 
100 
106 
108  void addTlConnection(const SUMOSAXAttributes& attrs);
109 
111  void removeTlConnection(const SUMOSAXAttributes& attrs);
112 
114  NBEdge* retrieveEdge(const SUMOSAXAttributes& attrs, SumoXMLAttr attr, bool& ok);
115 
117  int retrieveLaneIndex(const SUMOSAXAttributes& attrs, SumoXMLAttr attr, NBEdge* edge, bool& ok, bool isDelete = false);
118 
121 
123  std::set<std::string> mySeenIDs;
124 
125 private:
128 
131 
132 
133 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:59
The representation of a single edge during network building.
Definition: NBEdge.h:92
A loaded (complete) traffic light logic.
A container for traffic light definitions and built programs.
Importer for edge connections stored in XML.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NBEdgeCont & myEdgeCont
The edge container for retrieving edges.
bool myResetPhases
whether phases of a previously loaded traffic light must be reset
NIXMLTrafficLightsHandler(const NIXMLTrafficLightsHandler &s)
invalidated copy constructor
NBLoadedSUMOTLDef * myCurrentTL
The currently parsed traffic light.
int retrieveLaneIndex(const SUMOSAXAttributes &attrs, SumoXMLAttr attr, NBEdge *edge, bool &ok, bool isDelete=false)
parses a lane index and verifies its correctness
NBTrafficLightLogicCont & myTLLCont
The traffic light container to fill.
bool myIgnoreUnknown
whether definitions for unknown traffic lights shall be silently ignored
NIXMLTrafficLightsHandler & operator=(const NIXMLTrafficLightsHandler &s)
invalidated assignment operator
const std::set< std::string > & getSeenIDs()
void myEndElement(int element)
Called when a closing tag occurs.
NBEdge * retrieveEdge(const SUMOSAXAttributes &attrs, SumoXMLAttr attr, bool &ok)
parses and edge id an returns an existing edge
std::set< std::string > mySeenIDs
list of traffic light logics that were found
void addTlConnection(const SUMOSAXAttributes &attrs)
reads and adds tl-controlled connection
void removeTlConnection(const SUMOSAXAttributes &attrs)
reads and removes tl-controlled connection
NBLoadedSUMOTLDef * initTrafficLightLogic(const SUMOSAXAttributes &attrs, NBLoadedSUMOTLDef *currentTL)
NIXMLTrafficLightsHandler(NBTrafficLightLogicCont &tlCont, NBEdgeCont &ec, bool ignoreUnknown=false)
Constructor.
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.