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-2020 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 
59 protected:
61 
62 
70  void myStartElement(int element, const SUMOSAXAttributes& attrs);
71 
72 
79  void myEndElement(int element);
81 
82 
83 
84 private:
87 
90 
93 
96 
102 
104  void addTlConnection(const SUMOSAXAttributes& attrs);
105 
107  void removeTlConnection(const SUMOSAXAttributes& attrs);
108 
110  NBEdge* retrieveEdge(const SUMOSAXAttributes& attrs, SumoXMLAttr attr, bool& ok);
111 
113  int retrieveLaneIndex(const SUMOSAXAttributes& attrs, SumoXMLAttr attr, NBEdge* edge, bool& ok, bool isDelete = false);
114 
117 
118 
119 private:
122 
125 
126 
127 };
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:91
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
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
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.