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.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Importer for traffic lights stored in XML
16 /****************************************************************************/
17 #ifndef NIXMLTrafficLightsHandler_h
18 #define NIXMLTrafficLightsHandler_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
27 #include <netbuild/NBConnection.h>
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 class NBEdge;
34 class NBEdgeCont;
35 class MsgHandler;
36 class NBLoadedSUMOTLDef;
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
51 public:
55  NIXMLTrafficLightsHandler(NBTrafficLightLogicCont& tlCont, NBEdgeCont& ec, bool ignoreUnknown = false);
56 
57 
60 
61 
62 protected:
64 
65 
73  void myStartElement(int element, const SUMOSAXAttributes& attrs);
74 
75 
82  void myEndElement(int element);
84 
85 
86 
87 private:
90 
93 
96 
99 
105 
107  void addTlConnection(const SUMOSAXAttributes& attrs);
108 
110  void removeTlConnection(const SUMOSAXAttributes& attrs);
111 
113  NBEdge* retrieveEdge(const SUMOSAXAttributes& attrs, SumoXMLAttr attr, bool& ok);
114 
116  int retrieveLaneIndex(const SUMOSAXAttributes& attrs, SumoXMLAttr attr, NBEdge* edge, bool& ok, bool isDelete = false);
117 
120 
121 
122 private:
125 
128 
129 
130 };
131 
132 
133 #endif
134 
135 /****************************************************************************/
136 
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
A loaded (complete) traffic light logic.
NBEdgeCont & myEdgeCont
The edge container for retrieving edges.
NIXMLTrafficLightsHandler(NBTrafficLightLogicCont &tlCont, NBEdgeCont &ec, bool ignoreUnknown=false)
Constructor.
A container for traffic light definitions and built programs.
NBEdge * retrieveEdge(const SUMOSAXAttributes &attrs, SumoXMLAttr attr, bool &ok)
parses and edge id an returns an existing edge
The representation of a single edge during network building.
Definition: NBEdge.h:86
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
NBLoadedSUMOTLDef * initTrafficLightLogic(const SUMOSAXAttributes &attrs, NBLoadedSUMOTLDef *currentTL)
SAX-handler base for SUMO-files.
NBTrafficLightLogicCont & myTLLCont
The traffic light container to fill.
Encapsulated SAX-Attributes.
void addTlConnection(const SUMOSAXAttributes &attrs)
reads and adds tl-controlled connection
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
bool myIgnoreUnknown
whether definitions for unknown traffic lights shall be silently ignored
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:61
void removeTlConnection(const SUMOSAXAttributes &attrs)
reads and removes tl-controlled connection
bool myResetPhases
whether phases of a previously loaded traffic light must be reset
void myEndElement(int element)
Called when a closing tag occurs.
Importer for edge connections stored in XML.
NIXMLTrafficLightsHandler & operator=(const NIXMLTrafficLightsHandler &s)
invalidated assignment operator