Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSStateHandler.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2012-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20// Parser and output filter for routes and vehicles state saving and loading
21/****************************************************************************/
22#pragma once
23#include <config.h>
24
26#include "MSRouteHandler.h"
27
28
29// ===========================================================================
30// class declarations
31// ===========================================================================
32class MESegment;
33class MSRailSignal;
34
35
36// ===========================================================================
37// class definitions
38// ===========================================================================
44public:
46 MSStateHandler(const std::string& file, const SUMOTime offset);
47
49 virtual ~MSStateHandler();
50
55 static void saveState(const std::string& file, SUMOTime step, bool usePrefix = true);
56
58 SUMOTime getTime() const {
59 return myTime;
60 }
61
64 public:
66 static SUMOTime getTime(const std::string& fileName);
67
68 protected:
69 void myStartElement(int element, const SUMOSAXAttributes& attrs);
71 };
72
73protected:
75
76
84 void myStartElement(int element,
85 const SUMOSAXAttributes& attrs);
86
93 void myEndElement(int element);
95
97 void closeVehicle();
98
99private:
102
105
108
111
114
117
120
123
125 std::vector<SUMOSAXAttributes*> myDeviceAttrs;
126
129
131 std::set<std::string> myVehiclesToRemove;
132
135
138
139private:
141 static void saveRNGs(OutputDevice& out);
142
143private:
145 MSStateHandler(const MSStateHandler& s) = delete;
146
149};
long long int SUMOTime
Definition GUI.h:36
A single mesoscopic segment (cell)
Definition MESegment.h:49
Representation of a lane in the micro simulation.
Definition MSLane.h:84
A signal for rails.
Parser and container for routes during their loading.
handler to read only the simulation time from a state
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Callback method for an opening tag to implement by derived classes.
Parser and output filter for routes and vehicles state saving and loading.
MSRailSignal * myConstrainedSignal
rail signal for which constraints are being loaded
SUMOSAXAttributes * myAttrs
cached attrs (used when loading vehicles or transportables)
static void saveState(const std::string &file, SUMOTime step, bool usePrefix=true)
Saves the current state.
MSStateHandler(const MSStateHandler &s)=delete
Invalidated copy constructor.
int myQueIndex
que index
SUMOTime myTime
time
std::set< std::string > myVehiclesToRemove
vehicles that shall be removed when loading state
int myRemoved
vehicles that were removed when loading state
MSLink * myCurrentLink
current link being loaded
MESegment * mySegment
segment
MSLane * myCurrentLane
current lane being loaded
static void saveRNGs(OutputDevice &out)
save the state of random number generators
const SUMOTime myOffset
offset
Parameterised * myLastParameterised
the last object that potentially carries parameters
void closeVehicle()
Ends the processing of a vehicle.
SUMOTime getTime() const
get time
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
std::vector< SUMOSAXAttributes * > myDeviceAttrs
cached device attrs (used when loading vehicles)
MSStateHandler & operator=(const MSStateHandler &s)=delete
Invalidated assignment operator.
SUMOSAXAttributes * myVCAttrs
cached attrs for delayed loading of MSVehicleControl state
void myEndElement(int element)
Called when a closing tag occurs.
virtual ~MSStateHandler()
standard destructor
Static storage of an output device and its base (abstract) implementation.
An upper class for objects with additional parameters.
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.