Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // Parser and output filter for routes and vehicles state saving and loading
18 /****************************************************************************/
19 #ifndef MSStateHandler_h
20 #define MSStateHandler_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <utils/common/SUMOTime.h>
29 #include "MSRouteHandler.h"
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class MESegment;
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
46 public:
48  MSStateHandler(const std::string& file, const SUMOTime offset);
49 
51  virtual ~MSStateHandler();
52 
57  static void saveState(const std::string& file, SUMOTime step);
58 
60  SUMOTime getTime() const {
61  return myTime;
62  }
63 
64 protected:
66 
67 
75  void myStartElement(int element,
76  const SUMOSAXAttributes& attrs);
77 
84  void myEndElement(int element);
86 
88  void closeVehicle();
89 
90 private:
93 
96 
99 
102 
105 
108 
110  std::vector<SUMOSAXAttributes*> myDeviceAttrs;
111 
114 
116  std::set<std::string> myVehiclesToRemove;
117 
118 private:
120  static void saveRNGs(OutputDevice& out);
121 
122 private:
124  MSStateHandler(const MSStateHandler& s) = delete;
125 
127  MSStateHandler& operator=(const MSStateHandler& s) = delete;
128 };
129 
130 
131 #endif
132 
133 /****************************************************************************/
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
SUMOTime getTime() const
get time
MSStateHandler & operator=(const MSStateHandler &s)=delete
Invalidated assignment operator.
long long int SUMOTime
Definition: SUMOTime.h:35
Parameterised * myLastParameterised
the last object that potentially carries parameters
MSLane * myCurrentLane
current lane being loaded
Parser and output filter for routes and vehicles state saving and loading.
void closeVehicle()
Ends the processing of a vehicle.
MESegment * mySegment
segment
MSStateHandler(const std::string &file, const SUMOTime offset)
standard constructor
Encapsulated SAX-Attributes.
SUMOTime myTime
time
SUMOSAXAttributes * myAttrs
cached attrs (used when loading vehicles)
const SUMOTime myOffset
offset
An upper class for objects with additional parameters.
Definition: Parameterised.h:43
virtual ~MSStateHandler()
standard destructor
A single mesoscopic segment (cell)
Definition: MESegment.h:50
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
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
int myQueIndex
que index
static void saveRNGs(OutputDevice &out)
save the state of random number generators
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
Parser and container for routes during their loading.
static void saveState(const std::string &file, SUMOTime step)
Saves the current state.