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 /****************************************************************************/
16 // A device that performs vehicle rerouting based on current edge speeds
17 /****************************************************************************/
18 #ifndef MSTransportableDevice_Routing_h
19 #define MSTransportableDevice_Routing_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include "MSTransportableDevice.h"
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 class MSLane;
34 
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
52 public:
56  static void insertOptions(OptionsCont& oc);
57 
61  static bool checkOptions(OptionsCont& oc);
62 
63 
79  static void buildDevices(MSTransportable& p, std::vector<MSTransportableDevice*>& into);
80 
81 
84 
85 
87  const std::string deviceName() const {
88  return "rerouting";
89  }
90 
95  void saveState(OutputDevice& out) const;
96 
101  void loadState(const SUMOSAXAttributes& attrs);
102 
104  void reroute(const SUMOTime currentTime, const bool onInit = false);
105 
107  std::string getParameter(const std::string& key) const;
108 
110  void setParameter(const std::string& key, const std::string& value);
111 
112 
113 private:
114 
121  MSTransportableDevice_Routing(MSTransportable& holder, const std::string& id, SUMOTime period);
122 
138 
139 
140 private:
143 
146 
149 
150 private:
153 
156 
157 
158 };
159 
160 
161 #endif
162 
163 /****************************************************************************/
MSTransportableDevice_Routing::myPeriod
SUMOTime myPeriod
The period with which a vehicle shall be rerouted.
Definition: MSTransportableDevice_Routing.h:142
MSTransportableDevice_Routing::MSTransportableDevice_Routing
MSTransportableDevice_Routing(const MSTransportableDevice_Routing &)
Invalidated copy constructor.
MSTransportableDevice_Routing::insertOptions
static void insertOptions(OptionsCont &oc)
Inserts MSTransportableDevice_Routing-options.
Definition: MSTransportableDevice_Routing.cpp:42
MSTransportableDevice_Routing::setParameter
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key
Definition: MSTransportableDevice_Routing.cpp:114
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
MSTransportableDevice_Routing::buildDevices
static void buildDevices(MSTransportable &p, std::vector< MSTransportableDevice * > &into)
Build devices for the given person, if needed.
Definition: MSTransportableDevice_Routing.cpp:51
WrappingCommand< MSTransportableDevice_Routing >
MSTransportableDevice_Routing::loadState
void loadState(const SUMOSAXAttributes &attrs)
Loads the state of the device from the given description.
Definition: MSTransportableDevice_Routing.cpp:148
MSTransportableDevice_Routing::deviceName
const std::string deviceName() const
return the name for this type of device
Definition: MSTransportableDevice_Routing.h:87
MSTransportable
Definition: MSTransportable.h:58
MSTransportableDevice_Routing::checkOptions
static bool checkOptions(OptionsCont &oc)
checks MSTransportableDevice_Routing-options
MSTransportableDevice.h
MSTransportableDevice_Routing::getParameter
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key
Definition: MSTransportableDevice_Routing.cpp:105
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
MSTransportableDevice
Abstract in-person device.
Definition: MSTransportableDevice.h:52
MSTransportableDevice_Routing::reroute
void reroute(const SUMOTime currentTime, const bool onInit=false)
initiate the rerouting, create router / thread pool on first use
Definition: MSTransportableDevice_Routing.cpp:93
MSTransportableDevice_Routing::myRerouteCommand
WrappingCommand< MSTransportableDevice_Routing > * myRerouteCommand
The (optional) command responsible for rerouting.
Definition: MSTransportableDevice_Routing.h:148
MSTransportableDevice_Routing::wrappedRerouteCommandExecute
SUMOTime wrappedRerouteCommandExecute(SUMOTime currentTime)
Performs rerouting after a period.
Definition: MSTransportableDevice_Routing.cpp:86
config.h
MSTransportableDevice_Routing::myLastRouting
SUMOTime myLastRouting
The last time a routing took place.
Definition: MSTransportableDevice_Routing.h:145
MSTransportableDevice_Routing::MSTransportableDevice_Routing
MSTransportableDevice_Routing(MSTransportable &holder, const std::string &id, SUMOTime period)
Constructor.
Definition: MSTransportableDevice_Routing.cpp:66
MSTransportableDevice_Routing::saveState
void saveState(OutputDevice &out) const
Saves the state of the device.
Definition: MSTransportableDevice_Routing.cpp:137
MSTransportableDevice_Routing::operator=
MSTransportableDevice_Routing & operator=(const MSTransportableDevice_Routing &)
Invalidated assignment operator.
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:56
MSTransportableDevice_Routing
A device that performs person rerouting based on current edge speeds.
Definition: MSTransportableDevice_Routing.h:51
MSTransportableDevice_Routing::~MSTransportableDevice_Routing
~MSTransportableDevice_Routing()
Destructor.
Definition: MSTransportableDevice_Routing.cpp:77