43 #ifdef CHECK_MEMORY_LEAKS 45 #endif // CHECK_MEMORY_LEAKS 60 oc.
addDescription(
"device.example.parameter",
"Example Device",
"An exemplary parameter which can be used by all instances of the example device");
79 std::cout <<
"vehicle '" << v.
getID() <<
"' does not supply vehicle parameter 'example'. Using default of " << customParameter2 <<
"\n";
91 std::cout <<
"vehicle '" << v.
getID() <<
"' does not supply vType parameter 'example'. Using default of " << customParameter3 <<
"\n";
94 oc.
getFloat(
"device.example.parameter"),
97 into.push_back(device);
122 std::cout <<
"device '" <<
getID() <<
"' notifyMove: newSpeed=" << newSpeed <<
"\n";
125 if (otherDevice != 0) {
126 std::cout <<
" veh '" << veh.
getID() <<
" has device '" << otherDevice->
getID() <<
"'\n";
134 std::cout <<
"device '" <<
getID() <<
"' notifyEnter: reason=" << reason <<
" currentEdge=" << veh.
getEdge()->
getID() <<
"\n";
142 std::cout <<
"device '" <<
getID() <<
"' notifyLeave: reason=" << reason <<
" currentEdge=" << veh.
getEdge()->
getID() <<
"\n";
~MSDevice_Example()
Destructor.
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Saves departure info on insertion.
SUMOReal myCustomValue3
a value which is initialised based on a vType parameter
static SUMOReal _2SUMOReal(const E *const data)
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
virtual const MSEdge * getEdge() const =0
Returns the edge the vehicle is currently at.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
Notification
Definition of a vehicle state.
bool notifyMove(SUMOVehicle &veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Checks for waiting steps when the vehicle moves.
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
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.
bool notifyLeave(SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
Saves arrival info.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Example-options.
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
SUMOReal myCustomValue2
a value which is initialised based on a vehicle parameter
const std::string & getID() const
Returns the id.
const SUMOVTypeParameter & getParameter() const
Representation of a vehicle.
static void insertDefaultAssignmentOptions(const std::string &deviceName, const std::string &optionsTopic, OptionsCont &oc)
Adds common command options that allow to assign devices to vehicles.
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Abstract in-vehicle device.
static bool equippedByDefaultAssignmentOptions(const OptionsCont &oc, const std::string &deviceName, SUMOVehicle &v)
Determines whether a vehicle should get a certain device.
void generateOutput() const
Called on writing tripinfo output.
MSDevice_Example(SUMOVehicle &holder, const std::string &id, SUMOReal customValue1, SUMOReal customValue2, SUMOReal customValue3)
Constructor.
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
A storage for options typed value containers)
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
virtual MSDevice * getDevice(const std::type_info &type) const =0
Returns a device of the given type if it exists or 0.
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.
SUMOReal myCustomValue1
a value which is initialised based on a commandline/configuration option
virtual const std::string & getID() const =0
Get the vehicle's ID.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.