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-2015 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 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, const SUMOReal v,
65  SUMOReal& a, SUMOReal& s);
66 
67  void writeEmissions(std::ostream& o, const std::string id,
68  const SUMOEmissionClass c,
69  const SUMOReal t, const SUMOReal v,
70  SUMOReal a = INVALID_VALUE, SUMOReal s = INVALID_VALUE);
71 
72  void writeXMLEmissions(const std::string id,
73  const SUMOEmissionClass c,
74  const SUMOTime t, const SUMOReal v,
75  SUMOReal a = INVALID_VALUE, SUMOReal s = INVALID_VALUE);
76 
77  void writeSums(std::ostream& o, const std::string id);
78 
79 
80 protected:
82 
83 
93  void myStartElement(int element,
94  const SUMOSAXAttributes& attrs);
96 
97 
98 private:
99  const bool myComputeA;
102  std::ostream* myStdOut;
104  std::map<std::string, SUMOReal> myLastV;
107  std::map<std::string, PollutantsInterface::Emissions> mySums;
108  std::map<std::string, SUMOEmissionClass> myEmissionClassByType;
109  std::map<std::string, SUMOEmissionClass> myEmissionClassByVehicle;
110 
111 
112 private:
115 
118 
119 
120 };
121 
122 
123 #endif
124 
125 /****************************************************************************/
126 
void writeEmissions(std::ostream &o, const std::string id, const SUMOEmissionClass c, const SUMOReal t, const SUMOReal v, SUMOReal a=INVALID_VALUE, SUMOReal s=INVALID_VALUE)
const SUMOEmissionClass myDefaultClass
std::map< std::string, SUMOEmissionClass > myEmissionClassByType
Storage for collected values of all emission types.
SAX-handler base for SUMO-files.
const PollutantsInterface::Emissions computeEmissions(const std::string id, const SUMOEmissionClass c, const 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(const bool computeA, const SUMOEmissionClass defaultClass, const SUMOReal defaultSlope, std::ostream *stdOut, OutputDevice *xmlOut)
Constructor.
void writeXMLEmissions(const std::string id, const SUMOEmissionClass c, const SUMOTime t, const SUMOReal v, SUMOReal a=INVALID_VALUE, SUMOReal s=INVALID_VALUE)
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.
int SUMOTime
Definition: SUMOTime.h:43
const SUMOReal myDefaultSlope
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:218
std::map< std::string, SUMOReal > myLastV
std::map< std::string, PollutantsInterface::Emissions > mySums