44 #ifdef CHECK_MEMORY_LEAKS 46 #endif // CHECK_MEMORY_LEAKS 96 oc.
addDescription(
"device." + deviceName +
".probability", optionsTopic,
"The probability for a vehicle to have a '" + deviceName +
"' device");
99 oc.
addSynonyme(
"device." + deviceName +
".explicit",
"device." + deviceName +
".knownveh",
true);
100 oc.
addDescription(
"device." + deviceName +
".explicit", optionsTopic,
"Assign a '" + deviceName +
"' device to named vehicles");
103 oc.
addDescription(
"device." + deviceName +
".deterministic", optionsTopic,
"The '" + deviceName +
"' devices are set deterministic using a fraction of 1000");
110 bool haveByNumber =
false;
111 if (oc.
exists(
"device." + deviceName +
".deterministic") && oc.
getBool(
"device." + deviceName +
".deterministic")) {
114 if (oc.
exists(
"device." + deviceName +
".probability") && oc.
getFloat(
"device." + deviceName +
".probability") != 0) {
119 bool haveByName =
false;
120 if (oc.
exists(
"device." + deviceName +
".explicit") && oc.
isSet(
"device." + deviceName +
".explicit")) {
124 myExplicitIDs[deviceName].insert(idList.begin(), idList.end());
129 bool haveByParameter =
false;
130 bool parameterGiven =
false;
131 const std::string key =
"has." + deviceName +
".device";
133 parameterGiven =
true;
136 parameterGiven =
true;
139 return (haveByNumber && !parameterGiven) || haveByName || haveByParameter;
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
int getQuota(SUMOReal frac=-1) const
Returns the number of instances of the current vehicle that shall be emitted considering that "frac" ...
static bool _2bool(const E *const data)
converts a 0-terminated char-type array into the boolean value described by it
static std::map< std::string, std::set< std::string > > myExplicitIDs
vehicles which explicitly carry a device, sorted by device, first
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
static SUMOReal rand()
Returns a random real number in [0, 1)
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Example-options.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
static OptionsCont & getOptions()
Retrieves the options.
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Routing-options.
const SUMOVTypeParameter & getParameter() const
Representation of a vehicle.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
static void insertDefaultAssignmentOptions(const std::string &deviceName, const std::string &optionsTopic, OptionsCont &oc)
Adds common command options that allow to assign devices to vehicles.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_BTsender-options.
static MSDevice_Vehroutes * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into, int maxRoutes=INT_MAX)
Build devices for the given vehicle, if needed.
static bool checkOptions(OptionsCont &oc)
check device-specific options
static bool equippedByDefaultAssignmentOptions(const OptionsCont &oc, const std::string &deviceName, SUMOVehicle &v)
Determines whether a vehicle should get a certain device.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Example-options.
static void insertOptions()
Inserts MSDevice_Emissions-options.
A storage for options typed value containers)
static void insertOptions(OptionsCont &oc)
Inserts options for building devices.
static bool checkOptions(OptionsCont &oc)
checks MSDevice_Routing-options
bool knowsParameter(const std::string &key) const
Returns whether the parameter is known.
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_BTreceiver-options.
virtual const std::string & getID() const =0
Get the vehicle's ID.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
bool exists(const std::string &name) const
Returns the information whether the named option is known.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.