Eclipse SUMO - Simulation of Urban MObility
ODDistrictHandler.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 /****************************************************************************/
20 // An XML-Handler for districts
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include <string>
26 #include <utility>
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 class ODDistrict;
34 class ODDistrictCont;
35 
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
48 public:
55  ODDistrictHandler(ODDistrictCont& cont, const std::string& file);
56 
57 
60 
61 
62 protected:
64 
65 
76  void myStartElement(int element,
77  const SUMOSAXAttributes& attrs);
78 
79 
87  void myEndElement(int element);
89 
90 
91 private:
100  void openDistrict(const SUMOSAXAttributes& attrs);
101 
102 
114  void addSource(const SUMOSAXAttributes& attrs);
115 
116 
128  void addSink(const SUMOSAXAttributes& attrs);
129 
130 
135  void closeDistrict();
136 
137 
153  std::pair<std::string, double> parseTAZ(const SUMOSAXAttributes& attrs);
154 
155 private:
158 
161 
162 
163 private:
166 
169 
170 
171 };
A container for districts.
An XML-Handler for districts.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called when an opening-tag occurs.
ODDistrictHandler(const ODDistrictHandler &s)
invalidated copy constructor
void openDistrict(const SUMOSAXAttributes &attrs)
Begins the parsing of a district.
std::pair< std::string, double > parseTAZ(const SUMOSAXAttributes &attrs)
Returns the id and weight for a taz/tazSink/tazSource.
ODDistrictHandler(ODDistrictCont &cont, const std::string &file)
Constructor.
void addSource(const SUMOSAXAttributes &attrs)
Adds a read source to the current district.
ODDistrict * myCurrentDistrict
The currently parsed district.
~ODDistrictHandler()
Destructor.
void closeDistrict()
Closes the processing of the current district.
void addSink(const SUMOSAXAttributes &attrs)
Adds a read sink to the current district.
void myEndElement(int element)
Called when a closing tag occurs.
ODDistrictHandler & operator=(const ODDistrictHandler &s)
invalidated assignment operator
ODDistrictCont & myContainer
The container to add read districts to.
A district (origin/destination)
Definition: ODDistrict.h:42
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.