Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/mesosim/METypeHandler.h
193689 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2026 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
/****************************************************************************/
14
/// @file METypeHandler.h
15
/// @author Jakob Erdmann
16
/// @date Jan 2026
17
///
18
// The XML-Handler for loading meso edge types
19
// This is a dedicated handler because meso types must be loaded from additional
20
// files before any other objects are loaded from them
21
/****************************************************************************/
22
#pragma once
23
#include <config.h>
24
25
#include <utils/xml/SUMOSAXHandler.h>
26
27
// ===========================================================================
28
// class definitions
29
// ===========================================================================
30
31
class MSNet;
32
33
/**
34
* @class METypeHandler
35
* @brief The XML-Handler for meso edge type loading
36
*/
37
class METypeHandler : public SUMOSAXHandler {
38
39
public:
40
/** @brief Constructor
41
*
42
* @param[in] file Name of the parsed file
43
* @param[in, out] net The network to fill
44
* @param[in] detBuilder The detector builder to use
45
* @param[in] triggerBuilder The trigger builder to use
46
* @param[in] edgeBuilder The builder of edges to use
47
* @param[in] junctionBuilder The builder of junctions to use
48
*/
49
METypeHandler(const std::string& file, MSNet& net);
50
51
52
/// @brief Destructor
53
virtual ~METypeHandler();
54
55
bool haveSeenMesoEdgeType() const {
56
return myHaveSeenMesoEdgeType;
57
}
58
59
60
protected:
61
/// @name inherited from GenericSAXHandler
62
//@{
63
64
/** @brief Called on the opening of a tag;
65
*
66
* @param[in] element ID of the currently opened element
67
* @param[in] attrs Attributes within the currently opened element
68
* @exception ProcessError If something fails
69
* @see GenericSAXHandler::myStartElement
70
* @todo Refactor/describe
71
*/
72
void myStartElement(int element, const SUMOSAXAttributes& attrs);
73
74
75
/** @brief Called when a closing tag occurs
76
*
77
* @param[in] element ID of the currently opened element
78
* @exception ProcessError If something fails
79
* @see GenericSAXHandler::myEndElement
80
* @todo Refactor/describe
81
*/
82
void myEndElement(int element);
83
//@}
84
85
86
protected:
87
/** @brief Loads edge type specific meso parameters
88
* @param[in] attrs The attributes that hold the parameters
89
*/
90
void addMesoEdgeType(const SUMOSAXAttributes& attrs);
91
92
93
protected:
94
/// @brief The net to fill (preinitialised)
95
MSNet& myNet;
96
97
/// The id of the currently processed edge type
98
std::string myCurrentTypeID;
99
100
/// @brief whether edge type specific meso parameters were loaded
101
bool myHaveSeenMesoEdgeType;
102
103
private:
104
/** invalid copy constructor */
105
METypeHandler(const METypeHandler& s);
106
107
/** invalid assignment operator */
108
METypeHandler& operator=(const METypeHandler& s);
109
110
};
111
112