SUMO - Simulation of Urban MObility
TrajectoriesHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // An XML-Handler for amitran and netstate trajectories
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef TrajectoriesHandler_h
21 #define TrajectoriesHandler_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <string>
34 #include <utility>
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
48 public:
49  static const int INVALID_VALUE = -999999;
50 
51 public:
56  TrajectoriesHandler(const bool computeA, const bool computeAForward, const bool accelZeroCorrection,
57  const SUMOEmissionClass defaultClass,
58  const SUMOReal defaultSlope, std::ostream* stdOut, OutputDevice* xmlOut);
59 
60 
63 
64  const PollutantsInterface::Emissions computeEmissions(const std::string id,
65  const SUMOEmissionClass c, SUMOReal& v,
66  SUMOReal& a, SUMOReal& s);
67 
68  bool writeEmissions(std::ostream& o, const std::string id,
69  const SUMOEmissionClass c,
70  SUMOReal t, SUMOReal& v,
71  SUMOReal& a, SUMOReal& s);
72 
73  bool writeXMLEmissions(const std::string id,
74  const SUMOEmissionClass c,
75  SUMOTime t, SUMOReal& v,
76  SUMOReal a = INVALID_VALUE, SUMOReal s = INVALID_VALUE);
77 
78  void writeSums(std::ostream& o, const std::string id);
79 
80  void writeNormedSums(std::ostream& o, const std::string id, const SUMOReal factor);
81 
82 
83 protected:
85 
86 
96  void myStartElement(int element,
97  const SUMOSAXAttributes& attrs);
99 
100 
101 private:
102  const bool myComputeA;
103  const bool myComputeAForward;
107  std::ostream* myStdOut;
109  std::map<std::string, SUMOReal> myLastV;
112  std::map<std::string, PollutantsInterface::Emissions> mySums;
113  std::map<std::string, SUMOEmissionClass> myEmissionClassByType;
114  std::map<std::string, SUMOEmissionClass> myEmissionClassByVehicle;
115 
116 
117 private:
120 
123 
124 
125 };
126 
127 
128 #endif
129 
130 /****************************************************************************/
131 
bool writeXMLEmissions(const std::string id, const SUMOEmissionClass c, SUMOTime t, SUMOReal &v, SUMOReal a=INVALID_VALUE, SUMOReal s=INVALID_VALUE)
const PollutantsInterface::Emissions computeEmissions(const std::string id, const SUMOEmissionClass c, SUMOReal &v, SUMOReal &a, SUMOReal &s)
long long int SUMOTime
Definition: SUMOTime.h:43
const SUMOEmissionClass myDefaultClass
std::map< std::string, SUMOEmissionClass > myEmissionClassByType
Storage for collected values of all emission types.
TrajectoriesHandler(const bool computeA, const bool computeAForward, const bool accelZeroCorrection, const SUMOEmissionClass defaultClass, const SUMOReal defaultSlope, std::ostream *stdOut, OutputDevice *xmlOut)
Constructor.
SAX-handler base for SUMO-files.
bool writeEmissions(std::ostream &o, const std::string id, const SUMOEmissionClass c, SUMOReal t, SUMOReal &v, SUMOReal &a, SUMOReal &s)
static const int INVALID_VALUE
Encapsulated SAX-Attributes.
int SUMOEmissionClass
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called when an opening-tag occurs.
TrajectoriesHandler & operator=(const TrajectoriesHandler &s)
invalidated assignment operator
~TrajectoriesHandler()
Destructor.
std::map< std::string, SUMOEmissionClass > myEmissionClassByVehicle
void writeSums(std::ostream &o, const std::string id)
An XML-Handler for amitran and netstate trajectories.
void writeNormedSums(std::ostream &o, const std::string id, const SUMOReal factor)
const SUMOReal myDefaultSlope
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:213
std::map< std::string, SUMOReal > myLastV
std::map< std::string, PollutantsInterface::Emissions > mySums