Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
TrajectoriesHandler.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2014-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/****************************************************************************/
18// An XML-Handler for amitran and netstate trajectories
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include <string>
24#include <utility>
26
27class EnergyParams;
28
29// ===========================================================================
30// class definitions
31// ===========================================================================
39public:
40 static const int INVALID_VALUE = -999999;
41
42public:
47 TrajectoriesHandler(const bool computeA, const bool computeAForward, const bool accelZeroCorrection,
48 const SUMOEmissionClass defaultClass,
49 EnergyParams* params, long long int attributes,
50 const double defaultSlope, std::ostream* stdOut, OutputDevice* xmlOut);
51
52
55
56 const PollutantsInterface::Emissions computeEmissions(const std::string id,
57 const SUMOEmissionClass c, EnergyParams* params, double& v,
58 double& a, double& s);
59
60 bool writeEmissions(std::ostream& o, const std::string id,
61 const SUMOEmissionClass c,
62 EnergyParams* params, long long int attributes,
63 double t, double& v,
64 double& a, double& s);
65
66 bool writeXMLEmissions(const std::string id,
67 const SUMOEmissionClass c,
68 EnergyParams* params,
69 SUMOTime t, double& v,
70 double a = INVALID_VALUE, double s = INVALID_VALUE);
71
72 void writeSums(std::ostream& o, const std::string id);
73
74 void writeNormedSums(std::ostream& o, const std::string id, const double factor);
75
76
77protected:
79
80
90 void myStartElement(int element,
91 const SUMOSAXAttributes& attrs);
93
94private:
95 void writeOptional(std::ostream& o, long long int attributes, const SumoXMLAttr attr, double v);
96
97private:
98 const bool myComputeA;
103 long long int myAttributes;
104 const double myDefaultSlope;
105 std::ostream* myStdOut;
107 std::map<std::string, double> myLastV;
108 std::map<std::string, double> myLastSlope;
111 std::map<std::string, PollutantsInterface::Emissions> mySums;
112 std::map<std::string, SUMOEmissionClass> myEmissionClassByType;
113 std::map<std::string, SUMOEmissionClass> myEmissionClassByVehicle;
114
115
116private:
119
122
123
124};
long long int SUMOTime
Definition GUI.h:36
int SUMOEmissionClass
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
An upper class for objects with additional parameters.
Static storage of an output device and its base (abstract) implementation.
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.
An XML-Handler for amitran and netstate trajectories.
std::map< std::string, double > myLastSlope
const SUMOEmissionClass myDefaultClass
TrajectoriesHandler & operator=(const TrajectoriesHandler &s)
invalidated assignment operator
void writeNormedSums(std::ostream &o, const std::string id, const double factor)
void writeOptional(std::ostream &o, long long int attributes, const SumoXMLAttr attr, double v)
std::map< std::string, PollutantsInterface::Emissions > mySums
void writeSums(std::ostream &o, const std::string id)
static const int INVALID_VALUE
bool writeXMLEmissions(const std::string id, const SUMOEmissionClass c, EnergyParams *params, SUMOTime t, double &v, double a=INVALID_VALUE, double s=INVALID_VALUE)
std::map< std::string, SUMOEmissionClass > myEmissionClassByVehicle
std::map< std::string, SUMOEmissionClass > myEmissionClassByType
std::map< std::string, double > myLastV
TrajectoriesHandler(const TrajectoriesHandler &s)
invalidated copy constructor
const PollutantsInterface::Emissions computeEmissions(const std::string id, const SUMOEmissionClass c, EnergyParams *params, double &v, double &a, double &s)
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called when an opening-tag occurs.
bool writeEmissions(std::ostream &o, const std::string id, const SUMOEmissionClass c, EnergyParams *params, long long int attributes, double t, double &v, double &a, double &s)
Storage for collected values of all emission types.