Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/utils/handlers/MeanDataHandler.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 MeanDataHandler.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Nov 2022
17
///
18
// The XML-Handler for meanMeanData elements loading
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "CommonHandler.h"
24
25
// ===========================================================================
26
// class definitions
27
// ===========================================================================
28
/**
29
* @class MeanDataHandler
30
* @brief The XML-Handler for network loading
31
*
32
* The SAX2-handler responsible for parsing networks and routes to load.
33
* This is an extension of the MSRouteHandler as routes and vehicles may also
34
* be loaded from network descriptions.
35
*/
36
class MeanDataHandler : public CommonHandler {
37
38
public:
39
/// @brief Constructor
40
MeanDataHandler(const std::string& filename);
41
42
/// @brief Destructor
43
virtual ~MeanDataHandler();
44
45
/// @brief begin parse attributes
46
bool beginParseAttributes(SumoXMLTag tag, const SUMOSAXAttributes& attrs);
47
48
/// @brief end parse attributes
49
void endParseAttributes();
50
51
/// @brief parse SumoBaseObject (it's called recursivelly)
52
void parseSumoBaseObject(CommonXMLStructure::SumoBaseObject* obj);
53
54
/// @brief run post parser tasks
55
virtual bool postParserTasks() = 0;
56
57
/// @name build functions
58
/// @{
59
/// @brief Builds edgeMeanData
60
virtual bool buildEdgeMeanData(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& ID,
61
const std::string& file, SUMOTime period, SUMOTime begin, SUMOTime end, const bool trackVehicles,
62
const std::vector<std::string>& writtenAttributes, const bool aggregate, const std::vector<std::string>& edges,
63
const std::string& edgeFile, std::string excludeEmpty, const bool withInternal,
64
const std::vector<std::string>& detectPersons, const double minSamples, const double maxTravelTime,
65
const std::vector<std::string>& vTypes, const double speedThreshold) = 0;
66
67
/// @brief Builds laneMeanData
68
virtual bool buildLaneMeanData(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& ID,
69
const std::string& file, SUMOTime period, SUMOTime begin, SUMOTime end, const bool trackVehicles,
70
const std::vector<std::string>& writtenAttributes, const bool aggregate, const std::vector<std::string>& edges,
71
const std::string& edgeFile, std::string excludeEmpty, const bool withInternal,
72
const std::vector<std::string>& detectPersons, const double minSamples, const double maxTravelTime,
73
const std::vector<std::string>& vTypes, const double speedThreshold) = 0;
74
75
/// @}
76
77
private:
78
/// @name parse meanMeanData attributes
79
/// @{
80
/// @brief parse edgeMeanData attributes
81
void parseEdgeMeanData(const SUMOSAXAttributes& attrs);
82
83
/// @brief parse laneMeanData attributes
84
void parseLaneMeanData(const SUMOSAXAttributes& attrs);
85
86
/// @}
87
88
/// @brief invalidate default onstructor
89
MeanDataHandler() = delete;
90
91
/// @brief invalidate copy constructor
92
MeanDataHandler(const MeanDataHandler& s) = delete;
93
94
/// @brief invalidate assignment operator
95
MeanDataHandler& operator=(const MeanDataHandler& s) = delete;
96
};
97
98