Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/utils/handlers/MeanDataHandler.h
193780 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 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 : public CommonHandler {
30
31
public:
32
/**@brief Constructor
33
* @param[in] bucket FileBucket in which place the element
34
*/
35
MeanDataHandler(FileBucket* fileBucket);
36
37
/// @brief Destructor
38
virtual ~MeanDataHandler();
39
40
/// @brief begin parse attributes
41
bool beginParseAttributes(SumoXMLTag tag, const SUMOSAXAttributes& attrs);
42
43
/// @brief end parse attributes
44
void endParseAttributes();
45
46
/// @brief parse SumoBaseObject (it's called recursivelly)
47
void parseSumoBaseObject(CommonXMLStructure::SumoBaseObject* obj);
48
49
/// @name build functions
50
/// @{
51
52
/// @brief Builds edgeMeanData
53
virtual bool buildEdgeMeanData(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& ID,
54
const std::string& file, const std::string& type, const SUMOTime period, const SUMOTime begin,
55
const SUMOTime end, const bool trackVehicles, const std::vector<std::string>& writtenAttributes,
56
const bool aggregate, const std::vector<std::string>& edges, const std::string& edgeFile,
57
const std::string& excludeEmpty, const bool withInternal, const std::vector<std::string>& detectPersons,
58
const double minSamples, const double maxTravelTime, const std::vector<std::string>& vTypes,
59
const double speedThreshold) = 0;
60
61
/// @brief Builds laneMeanData
62
virtual bool buildLaneMeanData(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& ID,
63
const std::string& file, const std::string& type, const SUMOTime period, const SUMOTime begin,
64
const SUMOTime end, const bool trackVehicles, const std::vector<std::string>& writtenAttributes,
65
const bool aggregate, const std::vector<std::string>& edges, const std::string& edgeFile,
66
const std::string& excludeEmpty, const bool withInternal, const std::vector<std::string>& detectPersons,
67
const double minSamples, const double maxTravelTime, const std::vector<std::string>& vTypes,
68
const double speedThreshold) = 0;
69
70
/// @}
71
72
private:
73
/// @name parse meanMeanData attributes
74
/// @{
75
76
/// @brief parse edgeMeanData attributes
77
void parseEdgeMeanData(const SUMOSAXAttributes& attrs);
78
79
/// @brief parse laneMeanData attributes
80
void parseLaneMeanData(const SUMOSAXAttributes& attrs);
81
82
/// @}
83
84
/// @brief check mean data type
85
bool checkType(const SumoXMLTag currentTag, const std::string& id, const std::string& type);
86
87
/// @brief invalidate default onstructor
88
MeanDataHandler() = delete;
89
90
/// @brief invalidate copy constructor
91
MeanDataHandler(const MeanDataHandler& s) = delete;
92
93
/// @brief invalidate assignment operator
94
MeanDataHandler& operator=(const MeanDataHandler& s) = delete;
95
};
96
97