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 /****************************************************************************/
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:43
SUMOTime.h
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
MSStateHandler::operator=
MSStateHandler & operator=(const MSStateHandler &s)=delete
Invalidated assignment operator.
MESegment
A single mesoscopic segment (cell)
Definition: MESegment.h:50
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
MSStateHandler::myStartElement
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Definition: MSStateHandler.cpp:104
MSStateHandler::myEndElement
void myEndElement(int element)
Called when a closing tag occurs.
Definition: MSStateHandler.cpp:226
MSStateHandler::myOffset
const SUMOTime myOffset
offset
Definition: MSStateHandler.h:92
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
MSStateHandler::closeVehicle
void closeVehicle()
Ends the processing of a vehicle.
Definition: MSStateHandler.cpp:235
MSStateHandler::saveState
static void saveState(const std::string &file, SUMOTime step)
Saves the current state.
Definition: MSStateHandler.cpp:75
MSStateHandler::myQueIndex
int myQueIndex
que index
Definition: MSStateHandler.h:104
MSStateHandler::~MSStateHandler
virtual ~MSStateHandler()
standard destructor
Definition: MSStateHandler.cpp:70
MSStateHandler::myLastParameterised
Parameterised * myLastParameterised
the last object that potentially carries parameters
Definition: MSStateHandler.h:113
MSStateHandler::getTime
SUMOTime getTime() const
get time
Definition: MSStateHandler.h:60
MSStateHandler::mySegment
MESegment * mySegment
segment
Definition: MSStateHandler.h:98
MSStateHandler::myAttrs
SUMOSAXAttributes * myAttrs
cached attrs (used when loading vehicles)
Definition: MSStateHandler.h:107
MSStateHandler::myCurrentLane
MSLane * myCurrentLane
current lane being loaded
Definition: MSStateHandler.h:101
MSStateHandler::MSStateHandler
MSStateHandler(const std::string &file, const SUMOTime offset)
standard constructor
Definition: MSStateHandler.cpp:57
MSStateHandler::myTime
SUMOTime myTime
time
Definition: MSStateHandler.h:95
MSStateHandler::myDeviceAttrs
std::vector< SUMOSAXAttributes * > myDeviceAttrs
cached device attrs (used when loading vehicles)
Definition: MSStateHandler.h:110
MSRouteHandler
Parser and container for routes during their loading.
Definition: MSRouteHandler.h:54
MSStateHandler::saveRNGs
static void saveRNGs(OutputDevice &out)
save the state of random number generators
Definition: MSStateHandler.cpp:277
config.h
MSRouteHandler.h
MSStateHandler::myVehiclesToRemove
std::set< std::string > myVehiclesToRemove
vehicles that shall be removed when loading state
Definition: MSStateHandler.h:116
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:57
MSStateHandler
Parser and output filter for routes and vehicles state saving and loading.
Definition: MSStateHandler.h:45