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 SUMOEmissionClass defaultClass,
57  const SUMOReal defaultSlope, std::ostream* stdOut, OutputDevice* xmlOut);
58 
59 
62 
63  const PollutantsInterface::Emissions computeEmissions(const std::string id,
64  const SUMOEmissionClass c, SUMOReal& v,
65  SUMOReal& a, SUMOReal& s);
66 
67  bool writeEmissions(std::ostream& o, const std::string id,
68  const SUMOEmissionClass c,
69  SUMOReal t, SUMOReal& v,
70  SUMOReal& a, SUMOReal& s);
71 
72  bool writeXMLEmissions(const std::string id,
73  const SUMOEmissionClass c,
74  SUMOTime t, SUMOReal& v,
75  SUMOReal a = INVALID_VALUE, SUMOReal s = INVALID_VALUE);
76 
77  void writeSums(std::ostream& o, const std::string id);
78 
79  void writeNormedSums(std::ostream& o, const std::string id, const SUMOReal factor);
80 
81 
82 protected:
84 
85 
95  void myStartElement(int element,
96  const SUMOSAXAttributes& attrs);
98 
99 
100 private:
101  const bool myComputeA;
102  const bool myComputeAForward;
105  std::ostream* myStdOut;
107  std::map<std::string, SUMOReal> myLastV;
110  std::map<std::string, PollutantsInterface::Emissions> mySums;
111  std::map<std::string, SUMOEmissionClass> myEmissionClassByType;
112  std::map<std::string, SUMOEmissionClass> myEmissionClassByVehicle;
113 
114 
115 private:
118 
121 
122 
123 };
124 
125 
126 #endif
127 
128 /****************************************************************************/
129 
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.
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
TrajectoriesHandler(const bool computeA, const bool computeAForward, const SUMOEmissionClass defaultClass, const SUMOReal defaultSlope, std::ostream *stdOut, OutputDevice *xmlOut)
Constructor.