Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/utils/handlers/GeneralHandler.h
169678 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 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 GeneralHandler.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Sep 2021
17
///
18
// General element handler
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <utils/xml/SUMOSAXHandler.h>
24
25
// ===========================================================================
26
// class definitions
27
// ===========================================================================
28
29
class GeneralHandler : public SUMOSAXHandler {
30
31
public:
32
/**@brief Constructor
33
* @param[in] file Name of the parsed file
34
*/
35
GeneralHandler(const std::string& file);
36
37
/// @brief Destructor
38
~GeneralHandler();
39
40
/// @brief parse
41
bool parse();
42
43
private:
44
/// @brief start element
45
virtual void beginTag(SumoXMLTag tag, const SUMOSAXAttributes& attrs) = 0;
46
47
/// @brief end element
48
virtual void endTag() = 0;
49
50
/// @brief run post parser tasks
51
virtual bool postParserTasks() = 0;
52
53
/// @name inherited from SUMOSAXHandler
54
/// @{
55
/** @brief Called on the opening of a tag;
56
*
57
* @param[in] element ID of the currently opened element
58
* @param[in] attrs Attributes within the currently opened element
59
* @exception ProcessError If something fails
60
* @see GenericSAXHandler::myStartElement
61
* @todo Refactor/describe
62
*/
63
void myStartElement(int element, const SUMOSAXAttributes& attrs);
64
65
/** @brief Called when a closing tag occurs
66
*
67
* @param[in] element ID of the currently opened element
68
* @exception ProcessError If something fails
69
* @see GenericSAXHandler::myEndElement
70
* @todo Refactor/describe
71
*/
72
void myEndElement(int element);
73
74
/// @}
75
76
/// @brief invalidate default onstructor
77
GeneralHandler() = delete;
78
79
/// @brief invalidate copy constructor
80
GeneralHandler(const GeneralHandler& s) = delete;
81
82
/// @brief invalidate assignment operator
83
GeneralHandler& operator=(const GeneralHandler& s) = delete;
84
};
85
86
/****************************************************************************/
87
88