Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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
25
26
27// ===========================================================================
28// class declarations
29// ===========================================================================
30class NBEdge;
31class NBEdgeCont;
32class MsgHandler;
35
36
37// ===========================================================================
38// class definitions
39// ===========================================================================
48public:
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
63protected:
65
66
74 void myStartElement(int element, const SUMOSAXAttributes& attrs);
75
76
83 void myEndElement(int element);
85
86
87
88private:
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
125private:
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
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
NIXMLTrafficLightsHandler & operator=(const NIXMLTrafficLightsHandler &s)
invalidated assignment operator
void removeTlConnection(const SUMOSAXAttributes &attrs)
reads and removes tl-controlled connection
NBLoadedSUMOTLDef * initTrafficLightLogic(const SUMOSAXAttributes &attrs, NBLoadedSUMOTLDef *currentTL)
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.