SUMO - Simulation of Urban MObility
SUMOSAXAttributes Class Referenceabstract

Encapsulated SAX-Attributes. More...

#include <SUMOSAXAttributes.h>

Inheritance diagram for SUMOSAXAttributes:
Inheritance graph
Collaboration diagram for SUMOSAXAttributes:
Collaboration graph

Public Member Functions

template<typename T >
get (int attr, const char *objectid, bool &ok, bool report=true) const
 Tries to read given attribute assuming it is an int. More...
 
template<>
int getInternal (const int attr) const
 
template<>
long long int getInternal (const int attr) const
 
template<>
SUMOReal getInternal (const int attr) const
 
template<>
bool getInternal (const int attr) const
 
template<>
std::string getInternal (const int attr) const
 
template<>
RGBColor getInternal (const int) const
 
template<>
PositionVector getInternal (const int attr) const
 
template<>
Boundary getInternal (const int attr) const
 
template<typename T >
getOpt (int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
 Tries to read given attribute assuming it is an int. More...
 
SUMOTime getOptSUMOTimeReporting (int attr, const char *objectid, bool &ok, SUMOTime defaultValue, bool report=true) const
 Tries to read given attribute assuming it is a SUMOTime. More...
 
SUMOTime getSUMOTimeReporting (int attr, const char *objectid, bool &ok, bool report=true) const
 Tries to read given attribute assuming it is a SUMOTime. More...
 
 SUMOSAXAttributes (const std::string &objectType)
 
virtual ~SUMOSAXAttributes ()
 Destructor. More...
 

virtual methods for retrieving attribute values

static const std::string ENCODING = " encoding=\"UTF-8\""
 The encoding of parsed strings. More...
 
static bool myHaveInformedAboutDeprecatedDivider = false
 Information whether the usage of a deprecated divider was reported. More...
 
std::string myObjectType
 the object type to use in error reporting More...
 
virtual bool hasAttribute (int id) const =0
 Returns the information whether the named (by its enum-value) attribute is within the current list. More...
 
virtual bool hasAttribute (const std::string &id) const =0
 Returns the information whether the named attribute is within the current list. More...
 
virtual bool getBool (int id) const =0
 Returns the bool-value of the named (by its enum-value) attribute. More...
 
virtual int getInt (int id) const =0
 Returns the int-value of the named (by its enum-value) attribute. More...
 
virtual long long int getLong (int id) const =0
 Returns the long-value of the named (by its enum-value) attribute. More...
 
virtual std::string getString (int id) const =0
 Returns the string-value of the named (by its enum-value) attribute. More...
 
virtual std::string getStringSecure (int id, const std::string &def) const =0
 Returns the string-value of the named (by its enum-value) attribute. More...
 
virtual SUMOReal getFloat (int id) const =0
 Returns the SUMOReal-value of the named (by its enum-value) attribute. More...
 
virtual SUMOReal getFloat (const std::string &id) const =0
 Returns the SUMOReal-value of the named attribute. More...
 
virtual std::string getStringSecure (const std::string &id, const std::string &def) const =0
 Returns the string-value of the named (by its enum-value) attribute. More...
 
virtual SumoXMLEdgeFunc getEdgeFunc (bool &ok) const =0
 Returns the value of the named attribute. More...
 
virtual SumoXMLNodeType getNodeType (bool &ok) const =0
 Returns the value of the named attribute. More...
 
virtual RGBColor getColor () const =0
 Returns the value of the named attribute. More...
 
virtual PositionVector getShape (int attr) const =0
 Tries to read given attribute assuming it is a PositionVector. More...
 
virtual Boundary getBoundary (int attr) const =0
 Tries to read given attribute assuming it is a Boundary. More...
 
virtual std::vector< std::string > getStringVector (int attr) const =0
 Tries to read given attribute assuming it is a string vector. More...
 
virtual std::string getName (int attr) const =0
 Converts the given attribute id into a man readable string. More...
 
virtual void serialize (std::ostream &os) const =0
 Prints all attribute names and values into the given stream. More...
 
const std::string & getObjectType () const
 return the objecttype to which these attributes belong More...
 
std::ostream & operator<< (std::ostream &os, const SUMOSAXAttributes &src)
 
static void parseStringVector (const std::string &def, std::vector< std::string > &into)
 Splits the given string. More...
 
static void parseStringSet (const std::string &def, std::set< std::string > &into)
 Splits the given string, stores it in a set. More...
 
template<typename T >
getInternal (const int attr) const
 
void emitUngivenError (const std::string &attrname, const char *objectid) const
 
void emitEmptyError (const std::string &attrname, const char *objectid) const
 
void emitFormatError (const std::string &attrname, const std::string &type, const char *objectid) const
 
 SUMOSAXAttributes (const SUMOSAXAttributes &src)
 Invalidated copy constructor. More...
 
SUMOSAXAttributesoperator= (const SUMOSAXAttributes &src)
 Invalidated assignment operator. More...
 

Detailed Description

Encapsulated SAX-Attributes.

This class is an interface for using encapsulated SAX-attributes. Encapsulation is done to allow a common acces without the need to import all the Xerces-definitions.

Definition at line 64 of file SUMOSAXAttributes.h.

Constructor & Destructor Documentation

SUMOSAXAttributes::SUMOSAXAttributes ( const std::string &  objectType)

Definition at line 58 of file SUMOSAXAttributes.cpp.

SUMOSAXAttributes::SUMOSAXAttributes ( const SUMOSAXAttributes src)
private

Invalidated copy constructor.

Member Function Documentation

void SUMOSAXAttributes::emitEmptyError ( const std::string &  attrname,
const char *  objectid 
) const
protected

Definition at line 128 of file SUMOSAXAttributes.cpp.

References myObjectType, and WRITE_ERROR.

Referenced by get(), getOpt(), getOptSUMOTimeReporting(), and getSUMOTimeReporting().

void SUMOSAXAttributes::emitFormatError ( const std::string &  attrname,
const std::string &  type,
const char *  objectid 
) const
protected

Definition at line 142 of file SUMOSAXAttributes.cpp.

References myObjectType, and WRITE_ERROR.

Referenced by get(), getOpt(), getOptSUMOTimeReporting(), and getSUMOTimeReporting().

void SUMOSAXAttributes::emitUngivenError ( const std::string &  attrname,
const char *  objectid 
) const
protected

Definition at line 114 of file SUMOSAXAttributes.cpp.

References myObjectType, and WRITE_ERROR.

Referenced by get(), and getSUMOTimeReporting().

template<typename T >
T SUMOSAXAttributes::get ( int  attr,
const char *  objectid,
bool &  ok,
bool  report = true 
) const

Tries to read given attribute assuming it is an int.

If an error occurs (the attribute is not there, it is not numeric), "ok" is set to false. If report is true an error message is written to MsgHandler::getErrorInstance.

If the value could be read, "ok" is not changed, and the value is returned.

Parameters
[in]attrThe id of the attribute to read
[in]objectidThe name of the parsed object; used for error message generation
[out]okWhether the value could be read
[in]reportWhether errors shall be written to msg handler's error instance
Returns
The read value if given and correct; -1 if an error occured

Definition at line 443 of file SUMOSAXAttributes.h.

References emitEmptyError(), emitFormatError(), emitUngivenError(), getName(), and hasAttribute().

Referenced by NIImporter_SUMO::addConnection(), NLHandler::addConnection(), NIXMLConnectionsHandler::addCrossing(), NIXMLConnectionsHandler::addCustomShape(), NLHandler::addDistrict(), NLHandler::addDistrictEdge(), NLHandler::addE1Detector(), NLHandler::addE2Detector(), NLHandler::addE3Entry(), NLHandler::addE3Exit(), NIImporter_SUMO::addEdge(), NIXMLEdgesHandler::addEdge(), NLHandler::addEdgeLaneMeanData(), NLHandler::addInstantE1Detector(), NIXMLNodesHandler::addJoinCluster(), NIXMLNodesHandler::addJoinExclusion(), NIImporter_SUMO::addJunction(), NIImporter_SUMO::addLane(), NLHandler::addLane(), NIXMLEdgesHandler::addLane(), NIXMLNodesHandler::addNode(), SUMORouteHandler::addParam(), NLHandler::addParam(), RORouteHandler::addPersonTrip(), NIImporter_SUMO::addPhase(), NLHandler::addPhase(), ShapeHandler::addPOI(), ShapeHandler::addPoly(), NIImporter_SUMO::addRequest(), NLHandler::addRequest(), NLHandler::addRouteProbeDetector(), NIXMLEdgesHandler::addSplit(), ROJTRTurnDefLoader::addToEdge(), NLHandler::addVTypeProbeDetector(), NLHandler::addWAUTJunction(), NLHandler::addWAUTSwitch(), NLHandler::beginE3Detector(), NLHandler::beginEdgeParsing(), ROJTRTurnDefLoader::beginFromEdge(), SUMOVehicleParserHelper::beginVTypeParsing(), NLTriggerBuilder::buildVaporizer(), NIXMLEdgesHandler::deleteEdge(), NIXMLNodesHandler::deleteNode(), NLTriggerBuilder::getLane(), NLTriggerBuilder::getPosition(), NLHandler::initJunctionLogic(), NIImporter_SUMO::initTrafficLightLogic(), NIXMLTrafficLightsHandler::initTrafficLightLogic(), NLHandler::initTrafficLightLogic(), NIImporter_SUMO::loadLocation(), RODFDetectorHandler::myStartElement(), GUISettingsHandler::myStartElement(), PCTypeDefHandler::myStartElement(), ODAmitranHandler::myStartElement(), NIXMLTypesHandler::myStartElement(), NIXMLConnectionsHandler::myStartElement(), RONetHandler::myStartElement(), MSRouteHandler::myStartElement(), ROJTRTurnDefLoader::myStartElement(), RORouteHandler::myStartElement(), PCNetProjectionLoader::myStartElement(), TrajectoriesHandler::myStartElement(), PCLoaderXML::myStartElement(), NIImporter_MATSim::NodesHandler::myStartElement(), NIImporter_Vissim::NIVissimXMLHandler_Streckendefinition::myStartElement(), NLHandler::myStartElement(), NIImporter_MATSim::EdgesHandler::myStartElement(), PCLoaderOSM::NodesHandler::myStartElement(), NIImporter_Vissim::NIVissimXMLHandler_Zuflussdefinition::myStartElement(), SAXWeightsHandler::myStartElement(), NIImporter_Vissim::NIVissimXMLHandler_Parkplatzdefinition::myStartElement(), PCLoaderOSM::RelationsHandler::myStartElement(), NIImporter_Vissim::NIVissimXMLHandler_Fahrzeugklassendefinition::myStartElement(), NIImporter_OpenStreetMap::NodesHandler::myStartElement(), NIImporter_Vissim::NIVissimXMLHandler_VWunschentscheidungsdefinition::myStartElement(), PCLoaderOSM::EdgesHandler::myStartElement(), NIImporter_OpenStreetMap::EdgesHandler::myStartElement(), NIImporter_Vissim::NIVissimXMLHandler_Geschwindigkeitsverteilungsdefinition::myStartElement(), NIImporter_OpenStreetMap::RelationHandler::myStartElement(), NIImporter_Vissim::NIVissimXMLHandler_Routenentscheidungsdefinition::myStartElement(), NIImporter_OpenDrive::myStartElement(), NIImporter_Vissim::NIVissimXMLHandler_ConflictArea::myStartElement(), ODDistrictHandler::openDistrict(), NLHandler::openJunction(), MSRouteHandler::openRoute(), RORouteHandler::openRoute(), MSRouteHandler::openRouteDistribution(), RORouteHandler::openRouteDistribution(), MSRouteHandler::openVehicleTypeDistribution(), RORouteHandler::openVehicleTypeDistribution(), NLHandler::openWAUT(), RONetHandler::parseAccess(), NLTriggerBuilder::parseAndBuildCalibrator(), NLTriggerBuilder::parseAndBuildChargingStation(), NLTriggerBuilder::parseAndBuildLaneSpeedTrigger(), NLTriggerBuilder::parseAndBuildRerouter(), NLTriggerBuilder::parseAndBuildStoppingPlace(), SUMOVehicleParserHelper::parseCommonAttributes(), RONetHandler::parseConnection(), NIXMLConnectionsHandler::parseDeprecatedLaneDefinition(), RONetHandler::parseDistrict(), RONetHandler::parseDistrictEdge(), RONetHandler::parseEdge(), SUMOVehicleParserHelper::parseFlowAttributes(), RONetHandler::parseJunction(), RONetHandler::parseLane(), NIXMLConnectionsHandler::parseLaneDefinition(), AGActivityGenHandler::parseStation(), SUMORouteHandler::parseStop(), RONetHandler::parseStoppingPlace(), ODDistrictHandler::parseTAZ(), SUMOVehicleParserHelper::parseVehicleAttributes(), SUMOVehicleParserHelper::parseVTypeEmbedded(), MSRouteHandler::parseWalkPositions(), NIXMLNodesHandler::processNodeType(), NIImporter_SUMO::readPosition(), NIXMLTrafficLightsHandler::removeTlConnection(), NIXMLTrafficLightsHandler::retrieveEdge(), NIXMLTrafficLightsHandler::retrieveLaneIndex(), NLHandler::setLocation(), and NIXMLEdgesHandler::setNodes().

virtual bool SUMOSAXAttributes::getBool ( int  id) const
pure virtual

Returns the bool-value of the named (by its enum-value) attribute.

Tries to retrieve the attribute from the the attribute list. The retrieved attribute (which may be 0) is then parsed using TplConvert<XMLCh>::_2bool. If the attribute is empty or ==0, TplConvert<XMLCh>::_2bool throws an EmptyData-exception which is passed. If the value can not be parsed to a bool, TplConvert<XMLCh>::_2bool throws a BoolFormatException-exception which is passed.

Parameters
[in]idThe id of the attribute to return the value of
Returns
The attribute's value as a bool, if it could be read and parsed
Exceptions
EmptyDataIf the attribute is not known or the attribute value is an empty string
BoolFormatExceptionIf the attribute value can not be parsed to a bool

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

Referenced by getInternal(), MSStateHandler::myStartElement(), and ~SUMOSAXAttributes().

virtual Boundary SUMOSAXAttributes::getBoundary ( int  attr) const
pure virtual

Tries to read given attribute assuming it is a Boundary.

Parameters
[in]attrThe id of the attribute to read
Returns
The read value if given and not empty; empty Boundary if an error occured

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

Referenced by getInternal(), and ~SUMOSAXAttributes().

virtual RGBColor SUMOSAXAttributes::getColor ( ) const
pure virtual

Returns the value of the named attribute.

Tries to retrieve the attribute from the the attribute list.

Returns
The attribute's value as a RGBColor, if it could be read and parsed

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

Referenced by getInternal(), and ~SUMOSAXAttributes().

virtual SumoXMLEdgeFunc SUMOSAXAttributes::getEdgeFunc ( bool &  ok) const
pure virtual

Returns the value of the named attribute.

Tries to retrieve the attribute from the the attribute list.

Returns
The attribute's value as a string, if it could be read and parsed

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

Referenced by NIImporter_SUMO::addEdge(), NLHandler::beginEdgeParsing(), RONetHandler::parseEdge(), and ~SUMOSAXAttributes().

virtual SUMOReal SUMOSAXAttributes::getFloat ( int  id) const
pure virtual

Returns the SUMOReal-value of the named (by its enum-value) attribute.

Tries to retrieve the attribute from the the attribute list. The retrieved attribute (which may be 0) is then parsed using TplConvert<XMLCh>::_2SUMOReal. If the attribute is empty or ==0, TplConvert<XMLCh>::_2SUMOReal throws an EmptyData-exception which is passed. If the value can not be parsed to a SUMOReal, TplConvert<XMLCh>::_2SUMOReal throws a NumberFormatException-exception which is passed.

Parameters
[in]idThe id of the attribute to return the value of
Returns
The attribute's value as a float, if it could be read and parsed
Exceptions
EmptyDataIf the attribute is not known or the attribute value is an empty string
NumberFormatExceptionIf the attribute value can not be parsed to an SUMOReal

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

Referenced by NIImporter_SUMO::addLane(), getInternal(), getOptSUMOTimeReporting(), getSUMOTimeReporting(), MSVehicle::loadState(), MSStateHandler::myStartElement(), TrajectoriesHandler::myStartElement(), AGActivityGenHandler::parseBusStation(), AGActivityGenHandler::parseCityGates(), AGActivityGenHandler::parseClosingHour(), AGActivityGenHandler::parseOpeningHour(), AGActivityGenHandler::parseSchool(), AGActivityGenHandler::parseStreets(), SAXWeightsHandler::tryParse(), and ~SUMOSAXAttributes().

virtual SUMOReal SUMOSAXAttributes::getFloat ( const std::string &  id) const
pure virtual

Returns the SUMOReal-value of the named attribute.

Tries to retrieve the attribute from the the attribute list. The retrieved attribute (which may be 0) is then parsed using TplConvert<XMLCh>::_2SUMOReal. If the attribute is empty or ==0, TplConvert<XMLCh>::_2SUMOReal throws an EmptyData-exception which is passed. If the value can not be parsed to a SUMOReal, TplConvert<XMLCh>::_2SUMOReal throws a NumberFormatException-exception which is passed.

Parameters
[in]idThe name of the attribute to return the value of
Returns
The attribute's value as a float, if it could be read and parsed
Exceptions
EmptyDataIf the attribute is not known or the attribute value is an empty string
NumberFormatExceptionIf the attribute value can not be parsed to an SUMOReal

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

virtual int SUMOSAXAttributes::getInt ( int  id) const
pure virtual

Returns the int-value of the named (by its enum-value) attribute.

Tries to retrieve the attribute from the the attribute list. The retrieved attribute (which may be 0) is then parsed using TplConvert<XMLCh>::_2int. If the attribute is empty or ==0, TplConvert<XMLCh>::_2int throws an EmptyData-exception which is passed. If the value can not be parsed to an int, TplConvert<XMLCh>::_2int throws a NumberFormatException-exception which is passed.

Parameters
[in]idThe id of the attribute to return the value of
Returns
The attribute's value as an int, if it could be read and parsed
Exceptions
EmptyDataIf the attribute is not known or the attribute value is an empty string
NumberFormatExceptionIf the attribute value can not be parsed to an int

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

Referenced by getInternal(), MSStateHandler::myStartElement(), AGActivityGenHandler::parseBracket(), AGActivityGenHandler::parseBusLine(), AGActivityGenHandler::parseBusStation(), AGActivityGenHandler::parseClosingHour(), AGActivityGenHandler::parseFrequency(), AGActivityGenHandler::parseGeneralCityInfo(), AGActivityGenHandler::parseOpeningHour(), AGActivityGenHandler::parseSchool(), and ~SUMOSAXAttributes().

template<>
int SUMOSAXAttributes::getInternal ( const int  attr) const

Definition at line 188 of file SUMOSAXAttributes.cpp.

References getInt().

template<>
long long int SUMOSAXAttributes::getInternal ( const int  attr) const

Definition at line 196 of file SUMOSAXAttributes.cpp.

References getLong().

template<>
SUMOReal SUMOSAXAttributes::getInternal ( const int  attr) const

Definition at line 204 of file SUMOSAXAttributes.cpp.

References getFloat().

template<>
bool SUMOSAXAttributes::getInternal ( const int  attr) const

Definition at line 212 of file SUMOSAXAttributes.cpp.

References getBool().

template<>
std::string SUMOSAXAttributes::getInternal ( const int  attr) const

Definition at line 220 of file SUMOSAXAttributes.cpp.

References getString().

template<>
RGBColor SUMOSAXAttributes::getInternal ( const int  ) const

Definition at line 232 of file SUMOSAXAttributes.cpp.

References getColor().

template<>
PositionVector SUMOSAXAttributes::getInternal ( const int  attr) const

Definition at line 240 of file SUMOSAXAttributes.cpp.

References getShape().

template<>
Boundary SUMOSAXAttributes::getInternal ( const int  attr) const

Definition at line 248 of file SUMOSAXAttributes.cpp.

References getBoundary().

template<typename T >
T SUMOSAXAttributes::getInternal ( const int  attr) const
protected
virtual long long int SUMOSAXAttributes::getLong ( int  id) const
pure virtual

Returns the long-value of the named (by its enum-value) attribute.

Tries to retrieve the attribute from the the attribute list. The retrieved attribute (which may be 0) is then parsed using TplConvert<XMLCh>::_2long. If the attribute is empty or ==0, TplConvert<XMLCh>::_2long throws an EmptyData-exception which is passed. If the value can not be parsed to a long, TplConvert<XMLCh>::_2long throws a NumberFormatException-exception which is passed.

Parameters
[in]idThe id of the attribute to return the value of
Returns
The attribute's value as an int, if it could be read and parsed
Exceptions
EmptyDataIf the attribute is not known or the attribute value is an empty string
NumberFormatExceptionIf the attribute value can not be parsed to an int

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

Referenced by getInternal(), and ~SUMOSAXAttributes().

virtual std::string SUMOSAXAttributes::getName ( int  attr) const
pure virtual

Converts the given attribute id into a man readable string.

Parameters
[in]attrThe id of the attribute to return the name of
Returns
The name of the described attribute

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

Referenced by get(), getOpt(), getOptSUMOTimeReporting(), getSUMOTimeReporting(), SUMOVehicleParserHelper::parseFlowAttributes(), and ~SUMOSAXAttributes().

virtual SumoXMLNodeType SUMOSAXAttributes::getNodeType ( bool &  ok) const
pure virtual

Returns the value of the named attribute.

Tries to retrieve the attribute from the the attribute list.

Returns
The attribute's value as a string, if it could be read and parsed

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

Referenced by NIImporter_SUMO::addJunction(), NLHandler::openJunction(), and ~SUMOSAXAttributes().

const std::string& SUMOSAXAttributes::getObjectType ( ) const
inline
template<typename T >
T SUMOSAXAttributes::getOpt ( int  attr,
const char *  objectid,
bool &  ok,
defaultValue,
bool  report = true 
) const

Tries to read given attribute assuming it is an int.

If the attribute is not existing in the current element, the default value is returned. If an error occurs on parsing (the attribute is empty, it is not numeric), "ok" is set to false. If report is true an error message is written to MsgHandler::getErrorInstance.

If the value could be read, "ok" is not changed, and the value is returned.

Parameters
[in]attrThe id of the attribute to read
[in]objectidThe name of the parsed object; used for error message generation
[out]okWhether the value could be read
[in]defaultValueThe value to return if the attribute is not within the element
[in]reportWhether errors shall be written to msg handler's error instance
Returns
The read value if given and correct; the default value if the attribute does not exist; -1 if an error occured

Definition at line 469 of file SUMOSAXAttributes.h.

References emitEmptyError(), emitFormatError(), getName(), and hasAttribute().

Referenced by NLTriggerBuilder::addAccess(), NLDiscreteEventBuilder::addAction(), NIImporter_SUMO::addConnection(), NLHandler::addConnection(), NIXMLConnectionsHandler::addCrossing(), NLHandler::addE1Detector(), NLHandler::addE2Detector(), NLHandler::addE3Entry(), NLHandler::addE3Exit(), NIImporter_SUMO::addEdge(), NIXMLEdgesHandler::addEdge(), NLHandler::addEdgeLaneMeanData(), NLHandler::addInstantE1Detector(), NIImporter_SUMO::addJunction(), NIImporter_SUMO::addLane(), NLHandler::addLane(), NIXMLEdgesHandler::addLane(), RORouteHandler::addPersonTrip(), ShapeHandler::addPOI(), ShapeHandler::addPoly(), NIImporter_SUMO::addProhibition(), NLHandler::addRequest(), NIXMLEdgesHandler::addSplit(), MSRouteHandler::addStop(), RORouteHandler::addStop(), NIXMLTrafficLightsHandler::addTlConnection(), NLHandler::addWAUTJunction(), NLHandler::beginE3Detector(), NLHandler::beginEdgeParsing(), NLDiscreteEventBuilder::buildSaveTLStateCommand(), NLDiscreteEventBuilder::buildSaveTLSwitchesCommand(), NLDiscreteEventBuilder::buildSaveTLSwitchStatesCommand(), NLTriggerBuilder::getFileName(), NLTriggerBuilder::getPosition(), NIImporter_SUMO::initTrafficLightLogic(), NIXMLTrafficLightsHandler::initTrafficLightLogic(), NLHandler::initTrafficLightLogic(), RODFDetectorHandler::myStartElement(), GUISettingsHandler::myStartElement(), PCTypeDefHandler::myStartElement(), NIXMLTypesHandler::myStartElement(), NIXMLConnectionsHandler::myStartElement(), MSRouteHandler::myStartElement(), RORouteHandler::myStartElement(), MSCalibrator::myStartElement(), TrajectoriesHandler::myStartElement(), PCLoaderXML::myStartElement(), NIImporter_SUMO::myStartElement(), MSLaneSpeedTrigger::myStartElement(), NLHandler::myStartElement(), NIImporter_MATSim::EdgesHandler::myStartElement(), PCLoaderOSM::NodesHandler::myStartElement(), SAXWeightsHandler::myStartElement(), MSTriggeredRerouter::myStartElement(), PCLoaderOSM::RelationsHandler::myStartElement(), PCLoaderOSM::EdgesHandler::myStartElement(), NIImporter_OpenDrive::myStartElement(), NLHandler::openJunction(), MSRouteHandler::openRoute(), RORouteHandler::openRoute(), RORouteHandler::openRouteDistribution(), RONetHandler::parseAccess(), NLTriggerBuilder::parseAndBuildCalibrator(), NLTriggerBuilder::parseAndBuildChargingStation(), NLTriggerBuilder::parseAndBuildRerouter(), NLTriggerBuilder::parseAndBuildStoppingPlace(), SUMOVehicleParserHelper::parseCommonAttributes(), RONetHandler::parseEdge(), SUMOVehicleParserHelper::parseEmissionClass(), MSRouteHandler::parseFromViaTo(), RORouteHandler::parseFromViaTo(), AGActivityGenHandler::parseGeneralCityInfo(), SUMOVehicleParserHelper::parseGuiShape(), RONetHandler::parseLane(), NIXMLConnectionsHandler::parseLaneBound(), AGActivityGenHandler::parseParameters(), SUMORouteHandler::parseStop(), RONetHandler::parseStoppingPlace(), SUMOVehicleParserHelper::parseVehicleAttributes(), SUMOVehicleParserHelper::parseVehicleClass(), MSRouteHandler::parseWalkPositions(), NIXMLNodesHandler::processNodeType(), NIXMLNodesHandler::processTrafficLightDefinitions(), NIXMLEdgesHandler::tryGetLaneSpread(), NIXMLEdgesHandler::tryGetShape(), and ~SUMOSAXAttributes().

SUMOTime SUMOSAXAttributes::getOptSUMOTimeReporting ( int  attr,
const char *  objectid,
bool &  ok,
SUMOTime  defaultValue,
bool  report = true 
) const

Tries to read given attribute assuming it is a SUMOTime.

If the attribute is not existing in the current element, the default value is returned. If an error occurs on parsing (the attribute is empty, it is not numeric), "ok" is set to false. If report is true an error message is written to MsgHandler::getErrorInstance.

Otherwise, "ok" is not changed.

In dependence to the used time representation, either get<int> or get<SUMOReal> is used.

Parameters
[in]attrThe id of the attribute to read
[in]objectidThe name of the parsed object; used for error message generation
[out]okWhether the value could be read
[in]defaultValueThe value to return if the attribute is not within the element
[in]reportWhether errors shall be written to msg handler's error instance
Returns
The read value if given and correct; the default value if the attribute does not exist; -1 if an error occured

Definition at line 89 of file SUMOSAXAttributes.cpp.

References emitEmptyError(), emitFormatError(), getFloat(), getName(), and hasAttribute().

Referenced by NLHandler::addE2Detector(), NLHandler::addEdgeLaneMeanData(), NLHandler::addPhase(), NLHandler::addRouteProbeDetector(), NLHandler::beginE3Detector(), NLHandler::initTrafficLightLogic(), GUISettingsHandler::myStartElement(), MSRouteHandler::myStartElement(), RORouteHandler::myStartElement(), MSCalibrator::myStartElement(), MSTriggeredRerouter::myStartElement(), NLHandler::openWAUT(), NLTriggerBuilder::parseAndBuildCalibrator(), SUMORouteHandler::parseStop(), and ~SUMOSAXAttributes().

virtual PositionVector SUMOSAXAttributes::getShape ( int  attr) const
pure virtual

Tries to read given attribute assuming it is a PositionVector.

Parameters
[in]attrThe id of the attribute to read
Returns
The read value if given and not empty; empty position vector if an error occured

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

Referenced by getInternal(), and ~SUMOSAXAttributes().

virtual std::string SUMOSAXAttributes::getString ( int  id) const
pure virtual

Returns the string-value of the named (by its enum-value) attribute.

Tries to retrieve the attribute from the the attribute list. The retrieved attribute (which may be 0) is then parsed using TplConvert<XMLCh>::_2str. If the attribute is ==0, TplConvert<XMLCh>::_2str throws an EmptyData-exception which is passed.

Parameters
[in]idThe id of the attribute to return the value of
Returns
The attribute's value as a string, if it could be read and parsed
Exceptions
EmptyDataIf the attribute is not known or the attribute value is an empty string

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

Referenced by getInternal(), MEVehicle::loadState(), MSVehicle::loadState(), MSStateHandler::myStartElement(), TrajectoriesHandler::myStartElement(), AGActivityGenHandler::parseBusLine(), AGActivityGenHandler::parseBusStation(), AGActivityGenHandler::parseCityGates(), AGActivityGenHandler::parseSchool(), AGActivityGenHandler::parseStreets(), and ~SUMOSAXAttributes().

virtual std::string SUMOSAXAttributes::getStringSecure ( int  id,
const std::string &  def 
) const
pure virtual

Returns the string-value of the named (by its enum-value) attribute.

Tries to retrieve the attribute from the the attribute list. The retrieved attribute (which may be 0) is then parsed using TplConvert<XMLCh>::_2strSec. If the attribute is ==0, TplConvert<XMLCh>::_2strSec returns the default value.

Parameters
[in]idThe id of the attribute to return the value of
[in]defThe default value to return if the attribute is not in attributes
Returns
The attribute's value as a string, if it could be read and parsed
Exceptions
EmptyDataIf the attribute is not known or the attribute value is an empty string

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

Referenced by NIXMLEdgesHandler::addEdge(), NLHandler::addPhase(), NLHandler::addVTypeProbeDetector(), GUISettingsHandler::myStartElement(), MSTriggeredRerouter::myStartElement(), PCLoaderOSM::RelationsHandler::myStartElement(), NIImporter_OpenStreetMap::NodesHandler::myStartElement(), NIImporter_OpenStreetMap::EdgesHandler::myStartElement(), NIImporter_OpenStreetMap::RelationHandler::myStartElement(), NLHandler::openJunction(), GUISettingsHandler::parseSizeSettings(), GUISettingsHandler::parseTextSettings(), and ~SUMOSAXAttributes().

virtual std::string SUMOSAXAttributes::getStringSecure ( const std::string &  id,
const std::string &  def 
) const
pure virtual

Returns the string-value of the named (by its enum-value) attribute.

Tries to retrieve the attribute from the the attribute list. If the attribute is ==0, TplConvert<XMLCh>::_2strSec returns the default value.

Parameters
[in]idThe name of the attribute to return the value of
[in]defThe default value to return if the attribute is not in attributes
Returns
The attribute's value as a string, if it could be read and parsed

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

virtual std::vector<std::string> SUMOSAXAttributes::getStringVector ( int  attr) const
pure virtual

Tries to read given attribute assuming it is a string vector.

Parameters
[in]attrThe id of the attribute to read
Returns
The read value if given and not empty; empty vector if an error occured

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

Referenced by NLHandler::addDistrict(), NIImporter_SUMO::addRoundabout(), NLHandler::addRoundabout(), NIXMLEdgesHandler::addRoundabout(), ODDistrictHandler::openDistrict(), RONetHandler::parseDistrict(), and ~SUMOSAXAttributes().

SUMOTime SUMOSAXAttributes::getSUMOTimeReporting ( int  attr,
const char *  objectid,
bool &  ok,
bool  report = true 
) const

Tries to read given attribute assuming it is a SUMOTime.

If an error occurs (the attribute is not there, it is not numeric), "ok" is set to false and an error message is written to MsgHandler::getErrorInstance.

Otherwise, "ok" is not changed.

In dependence to the used time representation, either get<int> or get<SUMOReal> is used.

Parameters
[in]attrThe id of the attribute to read
[in]objectidThe name of the parsed object; used for error message generation
[out]okWhether the value could be read
[in]reportWhether errors shall be written to msg handler's error instance
Returns
The read value if given and correct; -1 if an error occured

Definition at line 63 of file SUMOSAXAttributes.cpp.

References emitEmptyError(), emitFormatError(), emitUngivenError(), getFloat(), getName(), hasAttribute(), and TIME2STEPS.

Referenced by NLHandler::addE1Detector(), NLHandler::addE2Detector(), NLHandler::addPhase(), NLHandler::addRouteProbeDetector(), NLHandler::addVTypeProbeDetector(), NLHandler::addWAUTSwitch(), NLHandler::beginE3Detector(), SUMOVehicleParserHelper::beginVTypeParsing(), NLTriggerBuilder::buildVaporizer(), SUMORouteHandler::myStartElement(), MSCalibrator::myStartElement(), TrajectoriesHandler::myStartElement(), MSLaneSpeedTrigger::myStartElement(), SUMOVehicleParserHelper::parseFlowAttributes(), and ~SUMOSAXAttributes().

virtual bool SUMOSAXAttributes::hasAttribute ( int  id) const
pure virtual

Returns the information whether the named (by its enum-value) attribute is within the current list.

Parameters
[in]idThe id of the attribute to search for
Returns
Whether the attribute is within the attributes

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

Referenced by NIXMLConnectionsHandler::addCrossing(), NLHandler::addDistrict(), NIXMLEdgesHandler::addEdge(), NIImporter_SUMO::addJunction(), NIImporter_SUMO::addLane(), NIXMLEdgesHandler::addLane(), NIXMLNodesHandler::addNode(), RORouteHandler::addPersonTrip(), NLHandler::addPhase(), ShapeHandler::addPOI(), NIImporter_SUMO::addRoundabout(), NLHandler::addRoundabout(), NIXMLEdgesHandler::addRoundabout(), NIXMLEdgesHandler::addSplit(), MSRouteHandler::addStop(), NLHandler::beginEdgeParsing(), SUMOVehicleParserHelper::beginVTypeParsing(), get(), getOpt(), getOptSUMOTimeReporting(), getSUMOTimeReporting(), NIXMLTrafficLightsHandler::initTrafficLightLogic(), MEVehicle::loadState(), MSVehicle::loadState(), NIXMLTypesHandler::myStartElement(), NIXMLConnectionsHandler::myStartElement(), MSRouteHandler::myStartElement(), ROJTRTurnDefLoader::myStartElement(), RORouteHandler::myStartElement(), TrajectoriesHandler::myStartElement(), PCLoaderXML::myStartElement(), NIImporter_MATSim::EdgesHandler::myStartElement(), PCLoaderOSM::RelationsHandler::myStartElement(), NIImporter_OpenStreetMap::NodesHandler::myStartElement(), NIImporter_OpenStreetMap::EdgesHandler::myStartElement(), NIImporter_OpenStreetMap::RelationHandler::myStartElement(), NIImporter_OpenDrive::myStartElement(), ODDistrictHandler::openDistrict(), NLHandler::openJunction(), MSRouteHandler::openRoute(), RORouteHandler::openRoute(), MSRouteHandler::openRouteDistribution(), RORouteHandler::openRouteDistribution(), MSRouteHandler::openVehicleTypeDistribution(), RORouteHandler::openVehicleTypeDistribution(), SUMOVehicleParserHelper::parseCommonAttributes(), RONetHandler::parseDistrict(), SUMOVehicleParserHelper::parseFlowAttributes(), MSRouteHandler::parseFromViaTo(), RORouteHandler::parseFromViaTo(), NIXMLConnectionsHandler::parseLaneInfo(), SUMORouteHandler::parseStop(), AGActivityGenHandler::parseStreets(), SUMOVehicleParserHelper::parseVTypeEmbedded(), MSRouteHandler::parseWalkPositions(), NIXMLNodesHandler::processNodeType(), NIImporter_SUMO::readPosition(), NIXMLEdgesHandler::setNodes(), NIXMLEdgesHandler::tryGetShape(), SAXWeightsHandler::tryParse(), and ~SUMOSAXAttributes().

virtual bool SUMOSAXAttributes::hasAttribute ( const std::string &  id) const
pure virtual

Returns the information whether the named attribute is within the current list.

Parameters
[in]idThe name of the attribute to search for
Returns
Whether the named attribute is within the attributes

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

SUMOSAXAttributes& SUMOSAXAttributes::operator= ( const SUMOSAXAttributes src)
private

Invalidated assignment operator.

void SUMOSAXAttributes::parseStringSet ( const std::string &  def,
std::set< std::string > &  into 
)
static

Splits the given string, stores it in a set.

Spaces, ",", and ";" are assumed to be separator characters. Though, in the case a "," or a ";" occurs, a warning is generated (once).

Parameters
[in]defThe string to split
[out]intoThe set to fill

Definition at line 171 of file SUMOSAXAttributes.cpp.

References StringTokenizer::hasNext(), myHaveInformedAboutDeprecatedDivider, StringTokenizer::next(), and WRITE_WARNING.

Referenced by SUMORouteHandler::parseStop().

void SUMOSAXAttributes::parseStringVector ( const std::string &  def,
std::vector< std::string > &  into 
)
static
virtual void SUMOSAXAttributes::serialize ( std::ostream &  os) const
pure virtual

Prints all attribute names and values into the given stream.

Parameters
[in]osThe stream to use

Implemented in SUMOSAXAttributesImpl_Binary, and SUMOSAXAttributesImpl_Xerces.

Referenced by operator<<(), and ~SUMOSAXAttributes().

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const SUMOSAXAttributes src 
)
friend

Definition at line 430 of file SUMOSAXAttributes.h.

Referenced by getObjectType().

Field Documentation

const std::string SUMOSAXAttributes::ENCODING = " encoding=\"UTF-8\""
static

The encoding of parsed strings.

Definition at line 382 of file SUMOSAXAttributes.h.

Referenced by OptionsCont::writeConfiguration(), OptionsCont::writeSchema(), and OptionsCont::writeXMLHeader().

bool SUMOSAXAttributes::myHaveInformedAboutDeprecatedDivider = false
staticprivate

Information whether the usage of a deprecated divider was reported.

Definition at line 415 of file SUMOSAXAttributes.h.

Referenced by parseStringSet(), and parseStringVector().

std::string SUMOSAXAttributes::myObjectType
private

the object type to use in error reporting

Definition at line 425 of file SUMOSAXAttributes.h.

Referenced by emitEmptyError(), emitFormatError(), emitUngivenError(), and getObjectType().


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