SUMOVehicleParameter Class Reference

#include <SUMOVehicleParameter.h>


Detailed Description

Structure representing possible vehicle parameter.

The fields yielding with "Procedure" describe whether the according value shall be used or another procedure is used to choose the value.

See also:
DepartLaneDefinition

DepartPosDefinition

DepartSpeedDefinition

Definition at line 192 of file SUMOVehicleParameter.h.


Public Member Functions

bool defaultOptionOverrides (const OptionsCont &oc, const std::string &optionName) const throw ()
 Returns whether the defaults shall be used.
 SUMOVehicleParameter () throw ()
 Constructor.
bool wasSet (int what) const throw ()
 Returns whether the given parameter was set.
void writeAs (const std::string &xmlElem, OutputDevice &dev, const OptionsCont &oc) const throw (IOError)
 Writes the parameters as a beginning element.

Static Public Member Functions

Depart/arrival-attributes verification
static bool arrivallaneValidate (const std::string &val) throw ()
 Validates a given arrivallane value.
static bool arrivalposValidate (const std::string &val) throw ()
 Validates a given arrivalpos value.
static bool arrivalspeedValidate (const std::string &val) throw ()
 Validates a given arrivalspeed value.
static bool departlaneValidate (const std::string &val) throw ()
 Validates a given departlane value.
static bool departposValidate (const std::string &val) throw ()
 Validates a given departpos value.
static bool departspeedValidate (const std::string &val) throw ()
 Validates a given departspeed value.

Data Fields

RGBColor color
 The vehicle's color.
std::string fromTaz
 The vehicle's origin zone (district).
std::string id
 The vehicle's id.
std::string line
 The vehicle's line (mainly for public transport).
std::string routeid
 The vehicle's route id.
int setParameter
 Information for the router which parameter were set.
std::vector< Stopstops
 List of the stops the vehicle will make.
std::string toTaz
 The vehicle's destination zone (district).
std::string vtypeid
 The vehicle's type id.
Arrival definition
int arrivalLane
 (optional) The lane the vehicle shall arrive on (not used yet)
ArrivalLaneDefinition arrivalLaneProcedure
 Information how the vehicle shall choose the lane to arrive on.
SUMOReal arrivalPos
 (optional) The position the vehicle shall arrive on
ArrivalPosDefinition arrivalPosProcedure
 Information how the vehicle shall choose the arrival position.
SUMOReal arrivalSpeed
 (optional) The final speed of the vehicle (not used yet)
ArrivalSpeedDefinition arrivalSpeedProcedure
 Information how the vehicle's end speed shall be chosen.
Departure definition
SUMOTime depart
 The vehicle's departure time.
int departLane
 (optional) The lane the vehicle shall depart from (index in edge)
DepartLaneDefinition departLaneProcedure
 Information how the vehicle shall choose the lane to depart from.
SUMOReal departPos
 (optional) The position the vehicle shall depart from
DepartPosDefinition departPosProcedure
 Information how the vehicle shall choose the departure position.
DepartDefinition departProcedure
 Information how the vehicle shall choose the depart time.
SUMOReal departSpeed
 (optional) The initial speed of the vehicle
DepartSpeedDefinition departSpeedProcedure
 Information how the vehicle's initial speed shall be chosen.
Repetition definition
int repetitionNumber
 The number of times the vehicle shall be repeatedly inserted.
SUMOReal repetitionOffset
 The time offset between vehicle reinsertions.
int repetitionsDone
 The number of times the vehicle was already inserted.

Data Structures

struct  Stop
 Definition of vehicle stop (position and duration). More...

Constructor & Destructor Documentation

SUMOVehicleParameter::SUMOVehicleParameter (  )  throw ()


Member Function Documentation

bool SUMOVehicleParameter::arrivallaneValidate ( const std::string &  val  )  throw () [static]

Validates a given arrivallane value.

Parameters:
[in] val The arrivallane value to validate
Returns:
Whether the given value is a valid arrivallane definition

Definition at line 271 of file SUMOVehicleParameter.cpp.

References TplConvert< E >::_2int(), MsgHandler::getErrorInstance(), and MsgHandler::inform().

Referenced by ROJTRFrame::checkOptions(), RODUAFrame::checkOptions(), and checkOptions().

00271                                                                       {
00272     if (val=="current") {
00273         return true;
00274     }
00275     try {
00276         TplConvert<char>::_2int(val.c_str());
00277         return true;
00278     } catch (NumberFormatException &) {
00279     } catch (EmptyData &) {
00280     }
00281     MsgHandler::getErrorInstance()->inform("Invalid arrivallane definition;\n must be one of (\"current\", or int>0)");
00282     return false;
00283 }

bool SUMOVehicleParameter::arrivalposValidate ( const std::string &  val  )  throw () [static]

Validates a given arrivalpos value.

Parameters:
[in] val The arrivalpos value to validate
Returns:
Whether the given value is a valid arrivalpos definition

Definition at line 287 of file SUMOVehicleParameter.cpp.

References TplConvert< E >::_2SUMOReal(), MsgHandler::getErrorInstance(), and MsgHandler::inform().

Referenced by ROJTRFrame::checkOptions(), RODUAFrame::checkOptions(), and checkOptions().

00287                                                                      {
00288     if (val=="random"||val=="max") {
00289         return true;
00290     }
00291     try {
00292         TplConvert<char>::_2SUMOReal(val.c_str());
00293         return true;
00294     } catch (NumberFormatException &) {
00295     } catch (EmptyData &) {
00296     }
00297     MsgHandler::getErrorInstance()->inform("Invalid arrivalpos definition;\n must be one of (\"random\", \"max\", or a float)");
00298     return false;
00299 }

bool SUMOVehicleParameter::arrivalspeedValidate ( const std::string &  val  )  throw () [static]

Validates a given arrivalspeed value.

Parameters:
[in] val The arrivalspeed value to validate
Returns:
Whether the given value is a valid arrivalspeed definition

Definition at line 303 of file SUMOVehicleParameter.cpp.

References TplConvert< E >::_2SUMOReal(), MsgHandler::getErrorInstance(), and MsgHandler::inform().

Referenced by ROJTRFrame::checkOptions(), RODUAFrame::checkOptions(), and checkOptions().

00303                                                                        {
00304     if (val=="current") {
00305         return true;
00306     }
00307     try {
00308         TplConvert<char>::_2SUMOReal(val.c_str());
00309         return true;
00310     } catch (NumberFormatException &) {
00311     } catch (EmptyData &) {
00312     }
00313     MsgHandler::getErrorInstance()->inform("Invalid arrivalspeed definition;\n must be one of (\"current\", or a float>0)");
00314     return false;
00315 }

bool SUMOVehicleParameter::defaultOptionOverrides ( const OptionsCont oc,
const std::string &  optionName 
) const throw ()

Returns whether the defaults shall be used.

Parameters:
[in] oc The options to get the options from
[in] optionName The name of the option to determine whether its value shall be used
Returns:
Whether the option is set and --defaults-override was set

Definition at line 58 of file SUMOVehicleParameter.cpp.

Referenced by writeAs().

00058                                                                                                              {
00059     return oc.isSet(optionName) && oc.getBool("defaults-override");
00060 }

bool SUMOVehicleParameter::departlaneValidate ( const std::string &  val  )  throw () [static]

Validates a given departlane value.

Parameters:
[in] val The departlane value to validate
Returns:
Whether the given value is a valid departlane definition

Definition at line 223 of file SUMOVehicleParameter.cpp.

References TplConvert< E >::_2int(), MsgHandler::getErrorInstance(), and MsgHandler::inform().

Referenced by ROJTRFrame::checkOptions(), RODUAFrame::checkOptions(), and checkOptions().

00223                                                                      {
00224     if (val=="departlane"||val=="random"||val=="free") {
00225         return true;
00226     }
00227     try {
00228         TplConvert<char>::_2int(val.c_str());
00229         return true;
00230     } catch (NumberFormatException &) {
00231     } catch (EmptyData &) {
00232     }
00233     MsgHandler::getErrorInstance()->inform("Invalid departlane definition;\n must be one of (\"departlane\", \"random\", \"free\", or an int>0)");
00234     return false;
00235 }

bool SUMOVehicleParameter::departposValidate ( const std::string &  val  )  throw () [static]

Validates a given departpos value.

Parameters:
[in] val The departpos value to validate
Returns:
Whether the given value is a valid departpos definition

Definition at line 239 of file SUMOVehicleParameter.cpp.

References TplConvert< E >::_2SUMOReal(), MsgHandler::getErrorInstance(), and MsgHandler::inform().

Referenced by ROJTRFrame::checkOptions(), RODUAFrame::checkOptions(), and checkOptions().

00239                                                                     {
00240     if (val=="random"||val=="random_free"||val=="free") {
00241         return true;
00242     }
00243     try {
00244         TplConvert<char>::_2SUMOReal(val.c_str());
00245         return true;
00246     } catch (NumberFormatException &) {
00247     } catch (EmptyData &) {
00248     }
00249     MsgHandler::getErrorInstance()->inform("Invalid departpos definition;\n must be one of (\"random\", \"random_free\", \"free\", or a float)");
00250     return false;
00251 }

bool SUMOVehicleParameter::departspeedValidate ( const std::string &  val  )  throw () [static]

Validates a given departspeed value.

Parameters:
[in] val The departspeed value to validate
Returns:
Whether the given value is a valid departspeed definition

Definition at line 255 of file SUMOVehicleParameter.cpp.

References TplConvert< E >::_2SUMOReal(), MsgHandler::getErrorInstance(), and MsgHandler::inform().

Referenced by ROJTRFrame::checkOptions(), RODUAFrame::checkOptions(), and checkOptions().

00255                                                                       {
00256     if (val=="random"||val=="max") {
00257         return true;
00258     }
00259     try {
00260         TplConvert<char>::_2SUMOReal(val.c_str());
00261         return true;
00262     } catch (NumberFormatException &) {
00263     } catch (EmptyData &) {
00264     }
00265     MsgHandler::getErrorInstance()->inform("Invalid departspeed definition;\n must be one of (\"random\", \"max\", or a float>0)");
00266     return false;
00267 }

bool SUMOVehicleParameter::wasSet ( int  what  )  const throw () [inline]

Returns whether the given parameter was set.

Parameters:
[in] what The parameter which one asks for
Returns:
Whether the given parameter was set

Definition at line 205 of file SUMOVehicleParameter.h.

References setParameter.

Referenced by RORDLoader_SUMOBase::myCharacters(), RORDLoader_TripDefs::myEndElement(), RORDGenerator_ODAmounts::myEndFlowAmountDef(), MSRouteHandler::myStartElement(), and writeAs().

00205                                         {
00206         return (setParameter&what)!=0;
00207     }

void SUMOVehicleParameter::writeAs ( const std::string &  xmlElem,
OutputDevice dev,
const OptionsCont oc 
) const throw (IOError)

Writes the parameters as a beginning element.

Parameters:
[in] xmlElem The name of the element to write
[in,out] dev The device to write into
[in] oc The options to get defaults from
Exceptions:
IOError not yet implemented

Definition at line 64 of file SUMOVehicleParameter.cpp.

References ARRIVAL_LANE_CURRENT, ARRIVAL_LANE_DEFAULT, ARRIVAL_LANE_GIVEN, ARRIVAL_POS_DEFAULT, ARRIVAL_POS_GIVEN, ARRIVAL_POS_MAX, ARRIVAL_POS_RANDOM, ARRIVAL_SPEED_CURRENT, ARRIVAL_SPEED_DEFAULT, ARRIVAL_SPEED_GIVEN, arrivalLane, arrivalLaneProcedure, arrivalPos, arrivalPosProcedure, arrivalSpeed, arrivalSpeedProcedure, color, defaultOptionOverrides(), depart, DEPART_LANE_DEFAULT, DEPART_LANE_DEPARTLANE, DEPART_LANE_FREE, DEPART_LANE_GIVEN, DEPART_LANE_RANDOM, DEPART_POS_DEFAULT, DEPART_POS_FREE, DEPART_POS_GIVEN, DEPART_POS_RANDOM, DEPART_POS_RANDOM_FREE, DEPART_SPEED_DEFAULT, DEPART_SPEED_GIVEN, DEPART_SPEED_MAX, DEPART_SPEED_RANDOM, departLane, departLaneProcedure, departPos, departPosProcedure, departSpeed, departSpeedProcedure, fromTaz, line, repetitionNumber, repetitionOffset, time2string(), toString(), toTaz, VEHPARS_ARRIVALLANE_SET, VEHPARS_ARRIVALPOS_SET, VEHPARS_ARRIVALSPEED_SET, VEHPARS_COLOR_SET, VEHPARS_DEPARTLANE_SET, VEHPARS_DEPARTPOS_SET, VEHPARS_DEPARTSPEED_SET, VEHPARS_LINE_SET, VEHPARS_PERIODFREQ_SET, VEHPARS_PERIODNUM_SET, VEHPARS_TAZ_SET, VEHPARS_VTYPE_SET, vtypeid, and wasSet().

Referenced by ROVehicle::saveAllAsXML().

00065                                                                           {
00066     dev.openTag(xmlElem) << " id=\"" << id << "\"";
00067     if (wasSet(VEHPARS_VTYPE_SET)) {
00068         dev << " type=\"" << vtypeid << "\"";
00069     }
00070     dev << " depart=\"" << time2string(depart) << "\"";
00071 
00072     // optional parameter
00073     //  departlane
00074     if (wasSet(VEHPARS_DEPARTLANE_SET) && !defaultOptionOverrides(oc, "departlane")) {
00075         std::string val;
00076         switch (departLaneProcedure) {
00077         case DEPART_LANE_GIVEN:
00078             val = toString(departLane);
00079             break;
00080         case DEPART_LANE_RANDOM:
00081             val = "random";
00082             break;
00083         case DEPART_LANE_FREE:
00084             val = "free";
00085             break;
00086         case DEPART_LANE_DEPARTLANE:
00087             val = "departlane";
00088             break;
00089         case DEPART_LANE_DEFAULT:
00090         default:
00091             break;
00092         }
00093         dev << " departlane=\"" << val << "\"";
00094     } else if (oc.isSet("departlane")) {
00095         dev << " departlane=\"" << oc.getString("departlane") << "\"";
00096     }
00097     //  departpos
00098     if (wasSet(VEHPARS_DEPARTPOS_SET) && !defaultOptionOverrides(oc, "departpos")) {
00099         std::string val;
00100         switch (departPosProcedure) {
00101         case DEPART_POS_GIVEN:
00102             val = toString(departPos);
00103             break;
00104         case DEPART_POS_RANDOM:
00105             val = "random";
00106             break;
00107         case DEPART_POS_RANDOM_FREE:
00108             val = "random_free";
00109             break;
00110         case DEPART_POS_FREE:
00111             val = "free";
00112             break;
00113         case DEPART_POS_DEFAULT:
00114         default:
00115             break;
00116         }
00117         dev << " departpos=\"" << val << "\"";
00118     } else if (oc.isSet("departpos")) {
00119         dev << " departpos=\"" << oc.getString("departpos") << "\"";
00120     }
00121     //  departspeed
00122     if (wasSet(VEHPARS_DEPARTSPEED_SET) && !defaultOptionOverrides(oc, "departspeed")) {
00123         std::string val;
00124         switch (departSpeedProcedure) {
00125         case DEPART_SPEED_GIVEN:
00126             val = toString(departSpeed);
00127             break;
00128         case DEPART_SPEED_RANDOM:
00129             val = "random";
00130             break;
00131         case DEPART_SPEED_MAX:
00132             val = "max";
00133             break;
00134         case DEPART_SPEED_DEFAULT:
00135         default:
00136             break;
00137         }
00138         dev << " departspeed=\"" << val << "\"";
00139     } else if (oc.isSet("departspeed")) {
00140         dev << " departspeed=\"" << oc.getString("departspeed") << "\"";
00141     }
00142 
00143     //  arrivallane
00144     if (wasSet(VEHPARS_ARRIVALLANE_SET) && !defaultOptionOverrides(oc, "arrivallane")) {
00145         std::string val;
00146         switch (arrivalLaneProcedure) {
00147         case ARRIVAL_LANE_GIVEN:
00148             val = toString(arrivalLane);
00149             break;
00150         case ARRIVAL_LANE_CURRENT:
00151             val = "current";
00152             break;
00153         case ARRIVAL_LANE_DEFAULT:
00154         default:
00155             break;
00156         }
00157         dev << " arrivallane=\"" << val << "\"";
00158     } else if (oc.isSet("arrivallane")) {
00159         dev << " arrivallane=\"" << oc.getString("arrivallane") << "\"";
00160     }
00161     //  arrivalpos
00162     if (wasSet(VEHPARS_ARRIVALPOS_SET) && !defaultOptionOverrides(oc, "arrivalpos")) {
00163         std::string val;
00164         switch (arrivalPosProcedure) {
00165         case ARRIVAL_POS_GIVEN:
00166             val = toString(arrivalPos);
00167             break;
00168         case ARRIVAL_POS_RANDOM:
00169             val = "random";
00170             break;
00171         case ARRIVAL_POS_MAX:
00172             val = "max";
00173             break;
00174         case ARRIVAL_POS_DEFAULT:
00175         default:
00176             break;
00177         }
00178         dev << " arrivalpos=\"" << val << "\"";
00179     } else if (oc.isSet("arrivalpos")) {
00180         dev << " arrivalpos=\"" << oc.getString("arrivalpos") << "\"";
00181     }
00182     //  arrivalspeed
00183     if (wasSet(VEHPARS_ARRIVALSPEED_SET) && !defaultOptionOverrides(oc, "arrivalspeed")) {
00184         std::string val;
00185         switch (arrivalSpeedProcedure) {
00186         case ARRIVAL_SPEED_GIVEN:
00187             val = toString(arrivalSpeed);
00188             break;
00189         case ARRIVAL_SPEED_CURRENT:
00190             val = "current";
00191             break;
00192         case ARRIVAL_SPEED_DEFAULT:
00193         default:
00194             break;
00195         }
00196         dev << " arrivalspeed=\"" << val << "\"";
00197     } else if (oc.isSet("arrivalspeed")) {
00198         dev << " arrivalspeed=\"" << oc.getString("arrivalspeed") << "\"";
00199     }
00200 
00201     // color
00202     if (wasSet(VEHPARS_COLOR_SET)) {
00203         dev << " color=\"" << color << "\"";
00204     }
00205     // repetition values
00206     if (wasSet(VEHPARS_PERIODNUM_SET)) {
00207         dev << " repno=\"" << repetitionNumber << "\"";
00208     }
00209     if (wasSet(VEHPARS_PERIODFREQ_SET)) {
00210         dev << " period=\"" << repetitionOffset << "\"";
00211     }
00212     if (wasSet(VEHPARS_LINE_SET)) {
00213         dev << " line=\"" << line << "\"";
00214     }
00215     if (wasSet(VEHPARS_TAZ_SET)) {
00216         dev << " fromtaz=\"" << fromTaz << "\" totaz=\"" << toTaz << "\"";
00217     }
00218     dev << ">\n";
00219 }


Field Documentation

(optional) The lane the vehicle shall arrive on (not used yet)

Definition at line 314 of file SUMOVehicleParameter.h.

Referenced by writeAs().

Information how the vehicle shall choose the lane to arrive on.

Definition at line 316 of file SUMOVehicleParameter.h.

Referenced by writeAs().

(optional) The position the vehicle shall arrive on

Definition at line 318 of file SUMOVehicleParameter.h.

Referenced by MSVehicle::replaceRoute(), and writeAs().

Information how the vehicle shall choose the arrival position.

Definition at line 320 of file SUMOVehicleParameter.h.

Referenced by writeAs().

(optional) The final speed of the vehicle (not used yet)

Definition at line 322 of file SUMOVehicleParameter.h.

Referenced by writeAs().

Information how the vehicle's end speed shall be chosen.

Definition at line 324 of file SUMOVehicleParameter.h.

Referenced by writeAs().

(optional) The lane the vehicle shall depart from (index in edge)

Definition at line 296 of file SUMOVehicleParameter.h.

Referenced by MSEdge::getDepartLane(), and writeAs().

Information how the vehicle shall choose the lane to depart from.

Definition at line 298 of file SUMOVehicleParameter.h.

Referenced by MSEdge::getDepartLane(), and writeAs().

(optional) The position the vehicle shall depart from

Definition at line 300 of file SUMOVehicleParameter.h.

Referenced by MSLane::emit(), MSEdge::emit(), and writeAs().

Information how the vehicle shall choose the departure position.

Definition at line 302 of file SUMOVehicleParameter.h.

Referenced by MSLane::emit(), MSEdge::emit(), and writeAs().

Information how the vehicle shall choose the depart time.

Definition at line 294 of file SUMOVehicleParameter.h.

Referenced by MSRouteHandler::closeVehicle(), SUMOVehicleParserHelper::parseVehicleAttributes(), and MSRouteHandler::retrieveLastReadVehicle().

Information how the vehicle's initial speed shall be chosen.

Definition at line 306 of file SUMOVehicleParameter.h.

Referenced by MSLane::emit(), and writeAs().

The vehicle's origin zone (district).

Definition at line 344 of file SUMOVehicleParameter.h.

Referenced by RORDLoader_SUMOBase::myCharacters(), MSRouteHandler::myStartElement(), MSVehicle::reroute(), and writeAs().

The vehicle's line (mainly for public transport).

Definition at line 341 of file SUMOVehicleParameter.h.

Referenced by MSVehicleControl::getWaitingVehicle(), and writeAs().

The number of times the vehicle was already inserted.

Definition at line 334 of file SUMOVehicleParameter.h.

Referenced by MSEmitControl::checkFlows(), MSRouteHandler::closeFlow(), and MSRouteHandler::retrieveLastReadVehicle().

Information for the router which parameter were set.

Definition at line 369 of file SUMOVehicleParameter.h.

Referenced by SUMOVehicleParserHelper::parseFlowAttributes(), SUMOVehicleParserHelper::parseVehicleAttributes(), and wasSet().

List of the stops the vehicle will make.

Definition at line 366 of file SUMOVehicleParameter.h.

Referenced by MSRouteHandler::myStartElement().

The vehicle's destination zone (district).

Definition at line 347 of file SUMOVehicleParameter.h.

Referenced by RORDLoader_SUMOBase::myCharacters(), MSVehicle::reroute(), and writeAs().


The documentation for this class was generated from the following files:

Generated on Wed May 5 00:07:00 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6