Eclipse SUMO - Simulation of Urban MObility
MSTransportableDevice_Routing.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2007-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 // A device that performs vehicle rerouting based on current edge speeds
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include "MSTransportableDevice.h"
26 
27 
28 // ===========================================================================
29 // class declarations
30 // ===========================================================================
31 class MSLane;
32 
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
50 public:
54  static void insertOptions(OptionsCont& oc);
55 
59  static bool checkOptions(OptionsCont& oc);
60 
61 
77  static void buildDevices(MSTransportable& p, std::vector<MSTransportableDevice*>& into);
78 
79 
82 
83 
85  const std::string deviceName() const {
86  return "rerouting";
87  }
88 
93  void saveState(OutputDevice& out) const;
94 
99  void loadState(const SUMOSAXAttributes& attrs);
100 
102  void reroute(const SUMOTime currentTime, const bool onInit = false);
103 
105  std::string getParameter(const std::string& key) const;
106 
108  void setParameter(const std::string& key, const std::string& value);
109 
110 
111 private:
112 
119  MSTransportableDevice_Routing(MSTransportable& holder, const std::string& id, SUMOTime period);
120 
136 
137 
138 private:
141 
144 
147 
148 private:
151 
154 
155 
156 };
long long int SUMOTime
Definition: GUI.h:35
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
A device that performs person rerouting based on current edge speeds.
static void buildDevices(MSTransportable &p, std::vector< MSTransportableDevice * > &into)
Build devices for the given person, if needed.
static void insertOptions(OptionsCont &oc)
Inserts MSTransportableDevice_Routing-options.
const std::string deviceName() const
return the name for this type of device
SUMOTime myLastRouting
The last time a routing took place.
MSTransportableDevice_Routing & operator=(const MSTransportableDevice_Routing &)
Invalidated assignment operator.
void loadState(const SUMOSAXAttributes &attrs)
Loads the state of the device from the given description.
MSTransportableDevice_Routing(MSTransportable &holder, const std::string &id, SUMOTime period)
Constructor.
void saveState(OutputDevice &out) const
Saves the state of the device.
SUMOTime wrappedRerouteCommandExecute(SUMOTime currentTime)
Performs rerouting after a period.
static bool checkOptions(OptionsCont &oc)
checks MSTransportableDevice_Routing-options
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key
WrappingCommand< MSTransportableDevice_Routing > * myRerouteCommand
The (optional) command responsible for rerouting.
SUMOTime myPeriod
The period with which a vehicle shall be rerouted.
void reroute(const SUMOTime currentTime, const bool onInit=false)
initiate the rerouting, create router / thread pool on first use
MSTransportableDevice_Routing(const MSTransportableDevice_Routing &)
Invalidated copy constructor.
Abstract in-person device.
A storage for options typed value containers)
Definition: OptionsCont.h:89
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
Encapsulated SAX-Attributes.