SUMO - Simulation of Urban MObility
MSStateHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2012-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // Parser and output filter for routes and vehicles state saving and loading
20 /****************************************************************************/
21 #ifndef MSStateHandler_h
22 #define MSStateHandler_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <utils/common/SUMOTime.h>
35 #include "MSRouteHandler.h"
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
41 class MESegment;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
52 public:
54  MSStateHandler(const std::string& file, const SUMOTime offset);
55 
57  virtual ~MSStateHandler();
58 
63  static void saveState(const std::string& file, SUMOTime step);
64 
65  SUMOTime getTime() const {
66  return myTime;
67  }
68 
69 protected:
71 
72 
80  void myStartElement(int element,
81  const SUMOSAXAttributes& attrs);
82 
83 
90  void myEndElement(int element);
92 
94  void closeVehicle();
95 
96 private:
100  std::pair<int, int> myEdgeAndLane;
102 
105 
107  std::vector<SUMOSAXAttributes*> myDeviceAttrs;
108 
111 
113  std::set<std::string> myVehiclesToRemove;
114 
115 
116 private:
118  MSStateHandler(const MSStateHandler& s);
119 
122 
123 };
124 
125 
126 #endif
127 
128 /****************************************************************************/
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
SUMOTime getTime() const
Parameterised * myLastParameterised
the last object that potentially carries parameters
Parser and output filter for routes and vehicles state saving and loading.
void closeVehicle()
Ends the processing of a vehicle.
MESegment * mySegment
std::pair< int, int > myEdgeAndLane
MSStateHandler(const std::string &file, const SUMOTime offset)
standard constructor
Encapsulated SAX-Attributes.
MSStateHandler & operator=(const MSStateHandler &s)
Invalidated assignment operator.
SUMOSAXAttributes * myAttrs
cached attrs (used when loading vehicles)
const SUMOTime myOffset
An upper class for objects with additional parameters.
Definition: Parameterised.h:50
virtual ~MSStateHandler()
standard destructor
A single mesoscopic segment (cell)
Definition: MESegment.h:56
void myEndElement(int element)
Called when a closing tag occurs.
std::vector< SUMOSAXAttributes * > myDeviceAttrs
cached device attrs (used when loading vehicles)
std::set< std::string > myVehiclesToRemove
vehicles that shall be removed when loading state
long long int SUMOTime
Definition: TraCIDefs.h:51
Parser and container for routes during their loading.
static void saveState(const std::string &file, SUMOTime step)
Saves the current state.