45 oc.
addSynonyme(
"person-device.rerouting.period",
"person-device.routing.period",
true);
46 oc.
addDescription(
"person-device.rerouting.period",
"Routing",
TL(
"The period with which the person shall be rerouted"));
106 if (key ==
"period") {
121 if (key ==
"period") {
126 }
else if (oldPeriod <= 0) {
140 std::vector<std::string> internals;
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
@ SVC_PEDESTRIAN
pedestrian
const int VEHPARS_FORCE_REROUTE
@ SUMO_ATTR_STATE
The state of a link.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void insertDefaultAssignmentOptions(const std::string &deviceName, const std::string &optionsTopic, OptionsCont &oc, const bool isPerson=false)
Adds common command options that allow to assign devices to vehicles.
static bool equippedByDefaultAssignmentOptions(const OptionsCont &oc, const std::string &deviceName, DEVICEHOLDER &v, bool outputOptionSet, const bool isPerson=false)
Determines whether a vehicle should get a certain device.
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSEventControl * getInsertionEvents()
Returns the event control for insertion events.
static SUMOTime getLastAdaptation()
Information when the last edge weight adaptation occurred.
static bool hasEdgeUpdates()
returns whether any edge weight updates will take place
static void initWeightUpdate()
intialize period edge weight update
static void initEdgeWeights(SUMOVehicleClass svc)
initialize the edge weights if not done before
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.
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.
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.
~MSTransportableDevice_Routing()
Destructor.
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
Abstract in-person device.
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
const std::string & getID() const
Returns the id.
A storage for options typed value containers)
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
void doRegister(const std::string &name, Option *o)
Adds an option under the given name.
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Encapsulated SAX-Attributes.
virtual std::string getString(int id, bool *isPresent=nullptr) const =0
Returns the string-value of the named (by its enum-value) attribute.
bool wasSet(int what) const
Returns whether the given parameter was set.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
void deschedule()
Marks this Command as being descheduled.