SUMO - Simulation of Urban MObility

SUMOVehicleParserHelper Class Reference

Helper methods for parsing vehicle attributes. More...

#include <SUMOVehicleParserHelper.h>

Static Public Member Functions

static SUMOVTypeParameter * beginVTypeParsing (const SUMOSAXAttributes &attrs) throw (ProcessError)
 Starts to parse a vehicle type.
static void closeVTypeParsing (SUMOVTypeParameter &vtype)
 Closes parsing of the vehicle type.
static SUMOEmissionClass parseEmissionClass (const SUMOSAXAttributes &attrs, const std::string &id)
 Parses the vehicle emission class.
static SUMOVehicleParameter * parseFlowAttributes (const SUMOSAXAttributes &attrs) throw (ProcessError)
 Parses a flow's attributes.
static SUMOVehicleShape parseGuiShape (const SUMOSAXAttributes &attrs, const std::string &id)
 Parses the vehicle class.
static SUMOVehicleParameter * parseVehicleAttributes (const SUMOSAXAttributes &attrs, bool skipID=false, bool skipDepart=false) throw (ProcessError)
 Parses a vehicle's attributes.
static SUMOVehicleClass parseVehicleClass (const SUMOSAXAttributes &attrs, const std::string &id)
 Parses the vehicle class.
static void parseVTypeEmbedded (SUMOVTypeParameter &into, int element, const SUMOSAXAttributes &attrs, bool fromVType=false) throw (ProcessError)
 Parses an element embedded in vtype definition.

Private Types

typedef std::map< SumoXMLTag,
std::set< SumoXMLAttr > > 
CFAttrMap

Static Private Member Functions

static const CFAttrMap & getAllowedCFModelAttrs ()
static void parseCommonAttributes (const SUMOSAXAttributes &attrs, SUMOVehicleParameter *ret, std::string element) throw (ProcessError)
 Parses attributes common to vehicles and flows.

Private Attributes

static bool gHaveWarnedAboutDeprecatedArrivalLane = false
static bool gHaveWarnedAboutDeprecatedArrivalPos = false
static bool gHaveWarnedAboutDeprecatedArrivalSpeed = false
static bool gHaveWarnedAboutDeprecatedDepartLane = false
static bool gHaveWarnedAboutDeprecatedDepartPos = false
static bool gHaveWarnedAboutDeprecatedDepartSpeed = false
static bool gHaveWarnedAboutDeprecatedMaxSpeed = false
static bool gHaveWarnedAboutDeprecatedTazs = false
static bool gHaveWarnedAboutDeprecatedVClass = false

Static Private Attributes

static CFAttrMap allowedCFModelAttrs
static bool gHaveWarnedAboutDeprecatedNumber = false

Detailed Description

Helper methods for parsing vehicle attributes.

This class supports helper methods for parsing a vehicle's attributes.

Definition at line 51 of file SUMOVehicleParserHelper.h.


Member Typedef Documentation

typedef std::map<SumoXMLTag, std::set<SumoXMLAttr> > SUMOVehicleParserHelper::CFAttrMap [private]

Definition at line 181 of file SUMOVehicleParserHelper.h.


Member Function Documentation

SUMOVTypeParameter * SUMOVehicleParserHelper::beginVTypeParsing ( const SUMOSAXAttributes &  attrs) throw (ProcessError) [static]

Starts to parse a vehicle type.

Parameters:
[in]attrThe SAX-attributes to get vehicle parameter from
Exceptions:
ProcessErrorIf an attribute's value is invalid
See also:
SUMOVTypeParameter
Note:
: the caller is responsible for deleting the returned pointer

Definition at line 451 of file SUMOVehicleParserHelper.cpp.

References SUMOVTypeParameter::color, SUMOVTypeParameter::defaultProbability, SUMOVTypeParameter::emissionClass, SUMOVTypeParameter::id, SUMOVTypeParameter::length, SUMOVTypeParameter::maxSpeed, SUMOVTypeParameter::minGap, RGBColor::parseColorReporting(), SUMOVTypeParameter::setParameter, SUMOVTypeParameter::shape, SUMOVTypeParameter::speedDev, SUMOVTypeParameter::speedFactor, SUMO_ATTR_COLOR, SUMO_ATTR_EMISSIONCLASS, SUMO_ATTR_GUIOFFSET, SUMO_ATTR_GUISHAPE, SUMO_ATTR_GUIWIDTH, SUMO_ATTR_ID, SUMO_ATTR_LENGTH, SUMO_ATTR_MAXSPEED, SUMO_ATTR_MAXSPEED__DEPRECATED, SUMO_ATTR_MINGAP, SUMO_ATTR_PROB, SUMO_ATTR_SPEEDDEV, SUMO_ATTR_SPEEDFACTOR, SUMO_ATTR_VCLASS, SUMO_ATTR_VCLASS__DEPRECATED, SUMO_TAG_CF_KRAUSS, toString(), SUMOVTypeParameter::vehicleClass, VTYPEPARS_COLOR_SET, VTYPEPARS_EMISSIONCLASS_SET, VTYPEPARS_LENGTH_SET, VTYPEPARS_MAXSPEED_SET, VTYPEPARS_MINGAP_SET, VTYPEPARS_PROBABILITY_SET, VTYPEPARS_SHAPE_SET, VTYPEPARS_SPEEDDEVIATION_SET, VTYPEPARS_SPEEDFACTOR_SET, VTYPEPARS_VEHICLECLASS_SET, VTYPEPARS_WIDTH_SET, SUMOVTypeParameter::width, and WRITE_WARNING.

Referenced by RORDLoader_TripDefs::myStartElement(), RORDLoader_SUMOBase::myStartElement(), and MSRouteHandler::myStartElement().

static void SUMOVehicleParserHelper::closeVTypeParsing ( SUMOVTypeParameter &  vtype) [inline, static]

Closes parsing of the vehicle type.

Returns:
The resulting vehicle type parameter
See also:
SUMOVTypeParameter

Definition at line 110 of file SUMOVehicleParserHelper.h.

References UNUSED_PARAMETER.

Referenced by RORDLoader_TripDefs::myEndElement(), RORDLoader_SUMOBase::myEndElement(), and MSRouteHandler::myEndElement().

void SUMOVehicleParserHelper::parseCommonAttributes ( const SUMOSAXAttributes &  attrs,
SUMOVehicleParameter *  ret,
std::string  element 
) throw (ProcessError) [static, private]

Parses attributes common to vehicles and flows.

Parses all attributes stored in "SUMOVehicleParameter".

See also:
SUMOVehicleParameter
Parameters:
[in]attrThe SAX-attributes to get vehicle parameter from
[out]retThe parameter to parse into
[in]elementThe name of the element (vehicle or flow)
Exceptions:
ProcessErrorIf an attribute's value is invalid

Definition at line 225 of file SUMOVehicleParserHelper.cpp.

References TplConvert< E >::_2int(), TplConvert< E >::_2SUMOReal(), ARRIVAL_LANE_CURRENT, ARRIVAL_LANE_GIVEN, ARRIVAL_POS_GIVEN, ARRIVAL_POS_MAX, ARRIVAL_POS_RANDOM, ARRIVAL_SPEED_CURRENT, ARRIVAL_SPEED_GIVEN, RGBColor::DEFAULT_COLOR, DEPART_LANE_ALLOWED_FREE, DEPART_LANE_BEST_FREE, DEPART_LANE_FREE, DEPART_LANE_GIVEN, DEPART_LANE_RANDOM, DEPART_POS_BASE, DEPART_POS_FREE, DEPART_POS_GIVEN, DEPART_POS_MAX_SPEED_GAP, DEPART_POS_PWAG_GENERIC, DEPART_POS_PWAG_SIMPLE, DEPART_POS_RANDOM, DEPART_POS_RANDOM_FREE, DEPART_SPEED_GIVEN, DEPART_SPEED_MAX, DEPART_SPEED_RANDOM, RGBColor::parseColor(), SUMO_ATTR_ARRIVALLANE, SUMO_ATTR_ARRIVALLANE__DEPRECATED, SUMO_ATTR_ARRIVALPOS, SUMO_ATTR_ARRIVALPOS__DEPRECATED, SUMO_ATTR_ARRIVALSPEED, SUMO_ATTR_ARRIVALSPEED__DEPRECATED, SUMO_ATTR_COLOR, SUMO_ATTR_DEPARTLANE, SUMO_ATTR_DEPARTLANE__DEPRECATED, SUMO_ATTR_DEPARTPOS, SUMO_ATTR_DEPARTPOS__DEPRECATED, SUMO_ATTR_DEPARTSPEED, SUMO_ATTR_DEPARTSPEED__DEPRECATED, SUMO_ATTR_FROM_TAZ, SUMO_ATTR_FROM_TAZ__DEPRECATED, SUMO_ATTR_LINE, SUMO_ATTR_REROUTE, SUMO_ATTR_ROUTE, SUMO_ATTR_TO_TAZ, SUMO_ATTR_TO_TAZ__DEPRECATED, SUMO_ATTR_TYPE, toString(), VEHPARS_ARRIVALLANE_SET, VEHPARS_ARRIVALPOS_SET, VEHPARS_ARRIVALSPEED_SET, VEHPARS_COLOR_SET, VEHPARS_DEPARTLANE_SET, VEHPARS_DEPARTPOS_SET, VEHPARS_DEPARTSPEED_SET, VEHPARS_FORCE_REROUTE, VEHPARS_LINE_SET, VEHPARS_ROUTE_SET, VEHPARS_TAZ_SET, VEHPARS_VTYPE_SET, and WRITE_WARNING.

SUMOEmissionClass SUMOVehicleParserHelper::parseEmissionClass ( const SUMOSAXAttributes &  attrs,
const std::string &  id 
) [static]

Parses the vehicle emission class.

When given, the vehicle emission class is parsed using getVehicleEmissionTypeID. Exceptions occuring within this process are catched and reported.

If no vehicle class is available in the attributes, the default class (SVE_UNKNOWN) is returned.

Parameters:
[in]attrsThe attributes to read the class from
[in]idThe id of the parsed element, for error message generation
Returns:
The parsed vehicle emission class
See also:
SUMOEmissionClass
Todo:
Recheck how errors are handled and what happens if they occure

Definition at line 644 of file SUMOVehicleParserHelper.cpp.

References SUMOSAXAttributes::getObjectType(), SUMOSAXAttributes::getOptStringReporting(), getVehicleEmissionTypeID(), SUMO_ATTR_EMISSIONCLASS, SVE_UNKNOWN, and WRITE_ERROR.

SUMOVehicleParameter * SUMOVehicleParserHelper::parseFlowAttributes ( const SUMOSAXAttributes &  attrs) throw (ProcessError) [static]

Parses a flow's attributes.

Parses all attributes stored in "SUMOVehicleParameter".

See also:
SUMOVehicleParameter
Parameters:
[in]attrThe SAX-attributes to get vehicle parameter from
Returns:
The parsed attribute structure if no error occured, 0 otherwise
Exceptions:
ProcessErrorIf an attribute's value is invalid
Note:
: the caller is responsible for deleting the returned pointer

Definition at line 64 of file SUMOVehicleParserHelper.cpp.

References SUMOVehicleParameter::depart, OptionsCont::getOptions(), SUMOVehicleParameter::id, SUMOVehicleParameter::repetitionNumber, SUMOVehicleParameter::repetitionOffset, SUMOVehicleParameter::setParameter, string2time(), SUMO_ATTR_BEGIN, SUMO_ATTR_END, SUMO_ATTR_ID, SUMO_ATTR_NO__DEPRECATED, SUMO_ATTR_NUMBER, SUMO_ATTR_PERIOD, SUMO_ATTR_VEHSPERHOUR, SUMOReal, SUMOTime_MAX, TIME2STEPS, toString(), VEHPARS_PERIODFREQ_SET, and WRITE_WARNING.

Referenced by MSRouteHandler::myStartElement().

SUMOVehicleShape SUMOVehicleParserHelper::parseGuiShape ( const SUMOSAXAttributes &  attrs,
const std::string &  id 
) [static]

Parses the vehicle class.

When given, the vehicle class is parsed using getVehicleShapeID. Exceptions occuring within this process are catched and reported.

If no vehicle class is available in the attributes, the default class (SVS_UNKNOWN) is returned.

Parameters:
[in]attrsThe attributes to read the class from
[in]idThe id of the parsed element, for error message generation
Returns:
The parsed vehicle shape
See also:
SUMOVehicleShape
Todo:
Recheck how errors are handled and what happens if they occure

Definition at line 661 of file SUMOVehicleParserHelper.cpp.

References SUMOSAXAttributes::getObjectType(), SUMOSAXAttributes::getOptStringReporting(), SUMO_ATTR_GUISHAPE, SumoVehicleShapeStrings, SVS_UNKNOWN, and WRITE_ERROR.

SUMOVehicleParameter * SUMOVehicleParserHelper::parseVehicleAttributes ( const SUMOSAXAttributes &  attrs,
bool  skipID = false,
bool  skipDepart = false 
) throw (ProcessError) [static]

Parses a vehicle's attributes.

Parses all attributes stored in "SUMOVehicleParameter".

See also:
SUMOVehicleParameter
Parameters:
[in]attrThe SAX-attributes to get vehicle parameter from
[in]skipIDWhether parsing the id shall be skipped
[in]skipDepartWhether parsing the departure time shall be skipped
Returns:
The parsed attribute structure if no error occured, 0 otherwise
Exceptions:
ProcessErrorIf an attribute's value is invalid
Note:
: the caller is responsible for deleting the returned pointer

Definition at line 168 of file SUMOVehicleParserHelper.cpp.

References SUMOVehicleParameter::depart, DEPART_GIVEN, DEPART_TRIGGERED, SUMOVehicleParameter::departProcedure, SUMOVehicleParameter::id, SUMOVehicleParameter::repetitionNumber, SUMOVehicleParameter::repetitionOffset, SUMOVehicleParameter::setParameter, SUMO_ATTR_DEPART, SUMO_ATTR_ID, SUMO_ATTR_PERIOD, SUMO_ATTR_REPNUMBER, VEHPARS_PERIODFREQ_SET, VEHPARS_PERIODNUM_SET, and WRITE_WARNING.

Referenced by RORDLoader_TripDefs::myStartElement(), RORDLoader_SUMOBase::myStartElement(), MSRouteHandler::myStartElement(), and RORDGenerator_ODAmounts::parseFlowAmountDef().

SUMOVehicleClass SUMOVehicleParserHelper::parseVehicleClass ( const SUMOSAXAttributes &  attrs,
const std::string &  id 
) [static]

Parses the vehicle class.

When given, the vehicle class is parsed using getVehicleClassID. Exceptions occuring within this process are catched and reported.

If no vehicle class is available in the attributes, the default class (SVC_UNKNOWN) is returned.

Parameters:
[in]attrsThe attributes to read the class from
[in]idThe id of the parsed element, for error message generation
Returns:
The parsed vehicle class
See also:
SUMOVehicleClass
Todo:
Recheck how errors are handled and what happens if they occure

Definition at line 624 of file SUMOVehicleParserHelper.cpp.

References SUMOSAXAttributes::getObjectType(), SUMOSAXAttributes::getOptStringReporting(), getVehicleClassID(), SUMOSAXAttributes::hasAttribute(), SUMO_ATTR_VCLASS, SUMO_ATTR_VCLASS__DEPRECATED, SVC_UNKNOWN, and WRITE_ERROR.

void SUMOVehicleParserHelper::parseVTypeEmbedded ( SUMOVTypeParameter &  into,
int  element,
const SUMOSAXAttributes &  attrs,
bool  fromVType = false 
) throw (ProcessError) [static]

Parses an element embedded in vtype definition.

Parameters:
in,filled]into The structure to fill with parsed values
[in]elementThe id of the currently parsed XML-element
[in]attrThe SAX-attributes to get vehicle parameter from
[in]fromVTypeWhether the attributes are a part of the vtype-definition
Exceptions:
ProcessErrorIf an attribute's value is invalid
See also:
SUMOVTypeParameter

Definition at line 534 of file SUMOVehicleParserHelper.cpp.

References SUMOXMLDefinitions::Tags, toString(), and WRITE_WARNING.

Referenced by RORDLoader_TripDefs::myStartElement(), RORDLoader_SUMOBase::myStartElement(), and MSRouteHandler::myStartElement().


Field Documentation


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines