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.org/sumo
3 // Copyright (C) 2007-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 // A device that performs vehicle rerouting based on current edge speeds
18 /****************************************************************************/
19 #ifndef MSTransportableDevice_Routing_h
20 #define MSTransportableDevice_Routing_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include "MSTransportableDevice.h"
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class MSLane;
35 
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
53 public:
57  static void insertOptions(OptionsCont& oc);
58 
62  static bool checkOptions(OptionsCont& oc);
63 
64 
80  static void buildDevices(MSTransportable& p, std::vector<MSTransportableDevice*>& into);
81 
82 
85 
86 
88  const std::string deviceName() const {
89  return "rerouting";
90  }
91 
96  void saveState(OutputDevice& out) const;
97 
102  void loadState(const SUMOSAXAttributes& attrs);
103 
105  void reroute(const SUMOTime currentTime, const bool onInit = false);
106 
108  std::string getParameter(const std::string& key) const;
109 
111  void setParameter(const std::string& key, const std::string& value);
112 
113 
114 private:
115 
122  MSTransportableDevice_Routing(MSTransportable& holder, const std::string& id, SUMOTime period);
123 
139 
140 
141 private:
144 
147 
150 
151 private:
154 
157 
158 
159 };
160 
161 
162 #endif
163 
164 /****************************************************************************/
long long int SUMOTime
Definition: SUMOTime.h:35
void loadState(const SUMOSAXAttributes &attrs)
Loads the state of the device from the given description.
SUMOTime myPeriod
The period with which a vehicle shall be rerouted.
static void insertOptions(OptionsCont &oc)
Inserts 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 ...
static bool checkOptions(OptionsCont &oc)
checks MSTransportableDevice_Routing-options
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key ...
const std::string deviceName() const
return the name for this type of device
Encapsulated SAX-Attributes.
Abstract in-person device.
static void buildDevices(MSTransportable &p, std::vector< MSTransportableDevice *> &into)
Build devices for the given person, if needed.
void reroute(const SUMOTime currentTime, const bool onInit=false)
initiate the rerouting, create router / thread pool on first use
WrappingCommand< MSTransportableDevice_Routing > * myRerouteCommand
The (optional) command responsible for rerouting.
void saveState(OutputDevice &out) const
Saves the state of the device.
A storage for options typed value containers)
Definition: OptionsCont.h:90
SUMOTime wrappedRerouteCommandExecute(SUMOTime currentTime)
Performs rerouting after a period.
SUMOTime myLastRouting
The last time a routing took place.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
MSTransportableDevice_Routing(MSTransportable &holder, const std::string &id, SUMOTime period)
Constructor.
MSTransportableDevice_Routing & operator=(const MSTransportableDevice_Routing &)
Invalidated assignment operator.
A device that performs person rerouting based on current edge speeds.