SUMO - Simulation of Urban MObility
SUMOSAXAttributesImpl_Xerces Class Reference

Encapsulated Xerces-SAX-attributes. More...

#include <SUMOSAXAttributesImpl_Xerces.h>

Inheritance diagram for SUMOSAXAttributesImpl_Xerces:
SUMOSAXAttributes

Public Member Functions

bool getBoolReporting (int attr, const char *objectid, bool &ok, bool report=true) const
 Tries to read given attribute assuming it is a boolean.
int getIntReporting (int attr, const char *objectid, bool &ok, bool report=true) const
 Tries to read given attribute assuming it is an int.
long getLongReporting (int attr, const char *objectid, bool &ok, bool report=true) const
 Tries to read given attribute assuming it is a long.
bool getOptBoolReporting (int attr, const char *objectid, bool &ok, bool defaultValue, bool report=true) const
 Tries to read given attribute assuming it is a boolean.
int getOptIntReporting (int attr, const char *objectid, bool &ok, int defaultValue, bool report=true) const
 Tries to read given attribute assuming it is an int.
std::string getOptStringReporting (int attr, const char *objectid, bool &ok, const std::string &defaultValue, bool report=true) const
 Tries to read given attribute assuming it is a string.
SUMOReal getOptSUMORealReporting (int attr, const char *objectid, bool &ok, SUMOReal defaultValue, bool report=true) const
 Tries to read given attribute assuming it is a SUMOReal.
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.
std::string getStringReporting (int attr, const char *objectid, bool &ok, bool report=true) const
 Tries to read given attribute assuming it is a string.
SUMOReal getSUMORealReporting (int attr, const char *objectid, bool &ok, bool report=true) const
 Tries to read given attribute assuming it is a SUMOReal.
SUMOTime getSUMOTimeReporting (int attr, const char *objectid, bool &ok, bool report=true) const
 Tries to read given attribute assuming it is a SUMOTime.
 SUMOSAXAttributesImpl_Xerces (const Attributes &attrs, const std::map< int, XMLCh * > &predefinedTags, const std::map< int, std::string > &predefinedTagsMML, const std::string &objectType)
 Constructor.
virtual ~SUMOSAXAttributesImpl_Xerces ()
 Destructor.

virtual methods for retrieving attribute values

const std::string & getObjectType () const
 return the objecttype to which these attributes belong
static const std::string ENCODING = " encoding=\"UTF-8\""
 The encoding of parsed strings.
static void parseStringVector (const std::string &def, std::vector< std::string > &into)
 Splits the given string.
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

methods for retrieving attribute values

typedef std::map< int, XMLCh * > AttrMap
 Definition of a map of attribute ids to their xerces-representation.
const Attributes & myAttrs
 The encapsulated attributes.
const AttrMapmyPredefinedTags
 Map of attribute ids to their xerces-representation.
const std::map< int,
std::string > & 
myPredefinedTagsMML
 Map of attribute ids to their (readable) string-representation.
bool hasAttribute (int id) const
 Returns the information whether the named (by its enum-value) attribute is within the current list.
bool getBool (int id) const throw (EmptyData, BoolFormatException)
 Returns the bool-value of the named (by its enum-value) attribute.
bool getBoolSecure (int id, bool def) const throw (EmptyData)
 Returns the bool-value of the named (by its enum-value) attribute or the given value if the attribute is not known.
int getInt (int id) const throw (EmptyData, NumberFormatException)
 Returns the int-value of the named (by its enum-value) attribute.
int getIntSecure (int id, int def) const throw (EmptyData, NumberFormatException)
 Returns the int-value of the named (by its enum-value) attribute.
long getLong (int id) const throw (EmptyData, NumberFormatException)
 Returns the long-value of the named (by its enum-value) attribute.
std::string getString (int id) const throw (EmptyData)
 Returns the string-value of the named (by its enum-value) attribute.
std::string getStringSecure (int id, const std::string &def) const throw (EmptyData)
 Returns the string-value of the named (by its enum-value) attribute.
SUMOReal getFloat (int id) const throw (EmptyData, NumberFormatException)
 Returns the SUMOReal-value of the named (by its enum-value) attribute.
SUMOReal getFloatSecure (int id, SUMOReal def) const throw (EmptyData, NumberFormatException)
 Returns the SUMOReal-value of the named (by its enum-value) attribute.
bool hasAttribute (const std::string &id) const
 Returns the information whether the named attribute is within the current list.
SUMOReal getFloat (const std::string &id) const throw (EmptyData, NumberFormatException)
 Returns the SUMOReal-value of the named attribute.
std::string getStringSecure (const std::string &id, const std::string &def) const
 Returns the string-value of the named (by its enum-value) attribute.
std::string getName (int attr) const
 Converts the given attribute id into a man readable string.
const XMLCh * getAttributeValueSecure (int id) const
 Returns Xerces-value of the named attribute.
 SUMOSAXAttributesImpl_Xerces (const SUMOSAXAttributesImpl_Xerces &src)
 Invalidated copy constructor.
SUMOSAXAttributesImpl_Xercesoperator= (const SUMOSAXAttributesImpl_Xerces &src)
 Invalidated assignment operator.

Detailed Description

Encapsulated Xerces-SAX-attributes.

See also:
SUMOSAXAttributes

Definition at line 59 of file SUMOSAXAttributesImpl_Xerces.h.


Member Typedef Documentation

typedef std::map<int, XMLCh*> SUMOSAXAttributesImpl_Xerces::AttrMap [private]

Definition of a map of attribute ids to their xerces-representation.

Definition at line 309 of file SUMOSAXAttributesImpl_Xerces.h.


Constructor & Destructor Documentation

SUMOSAXAttributesImpl_Xerces::SUMOSAXAttributesImpl_Xerces ( const Attributes &  attrs,
const std::map< int, XMLCh * > &  predefinedTags,
const std::map< int, std::string > &  predefinedTagsMML,
const std::string &  objectType 
)

Constructor.

Parameters:
[in]attrsThe encapsulated xerces-attributes
[in]predefinedTagsMap of attribute ids to their xerces-representation
[in]predefinedTagsMMLMap of attribute ids to their (readable) string-representation

Definition at line 50 of file SUMOSAXAttributesImpl_Xerces.cpp.

Invalidated copy constructor.


Member Function Documentation

const XMLCh * SUMOSAXAttributesImpl_Xerces::getAttributeValueSecure ( int  id) const [private]

Returns Xerces-value of the named attribute.

It is assumed that this attribute is within the stored attributes.

Parameters:
[in]idThe id of the attribute to retrieve the vale of
Returns:
The xerces-value of the attribute

Definition at line 154 of file SUMOSAXAttributesImpl_Xerces.cpp.

References myAttrs, and myPredefinedTags.

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

Implements SUMOSAXAttributes.

Definition at line 75 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert< E >::_2bool().

bool SUMOSAXAttributes::getBoolReporting ( int  attr,
const char *  objectid,
bool ok,
bool  report = true 
) const [inherited]

Tries to read given attribute assuming it is a boolean.

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

Otherwise, "ok" is not changed.

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; false if an error occured

Definition at line 182 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::emitEmptyError(), SUMOSAXAttributes::emitFormatError(), SUMOSAXAttributes::emitUngivenError(), SUMOSAXAttributes::getBool(), SUMOSAXAttributes::getName(), and SUMOSAXAttributes::hasAttribute().

bool SUMOSAXAttributesImpl_Xerces::getBoolSecure ( int  id,
bool  def 
) const throw (EmptyData) [virtual]

Returns the bool-value of the named (by its enum-value) attribute or the given value if the attribute is not known.

Tries to retrieve the attribute from the the attribute list. The retrieved attribute (which may be 0) is then parsed using TplConvert<XMLCh>::_2boolSec. If the attribute is empty, TplConvert<XMLCh>::_2boolSec throws an EmptyData-exception which is passed. If the attribute==0, TplConvert<XMLCh>::_2boolSec 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 bool, if it could be read and parsed
Exceptions:
EmptyDataIf the attribute value is an empty string

Implements SUMOSAXAttributes.

Definition at line 81 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvertSec< E >::_2boolSec().

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

Implements SUMOSAXAttributes.

Definition at line 141 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert< E >::_2SUMOReal().

SUMOReal SUMOSAXAttributesImpl_Xerces::getFloat ( const std::string &  id) const throw (EmptyData, NumberFormatException) [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

Implements SUMOSAXAttributes.

Definition at line 162 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert< E >::_2SUMOReal(), and SUMOReal.

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>::_2SUMORealSec. If the attribute is empty, TplConvert<XMLCh>::_2SUMORealSec throws an EmptyData-exception which is passed. If the attribute==0, TplConvert<XMLCh>::_2SUMORealSec returns the default value. If the value can not be parsed to a SUMOReal, TplConvert<XMLCh>::_2SUMORealSec throws a NumberFormatException-exception which is passed.

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 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

Implements SUMOSAXAttributes.

Definition at line 147 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvertSec< E >::_2SUMORealSec().

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

Implements SUMOSAXAttributes.

Definition at line 87 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert< E >::_2int().

int SUMOSAXAttributes::getIntReporting ( int  attr,
const char *  objectid,
bool ok,
bool  report = true 
) const [inherited]

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 60 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::emitEmptyError(), SUMOSAXAttributes::emitFormatError(), SUMOSAXAttributes::emitUngivenError(), SUMOSAXAttributes::getInt(), SUMOSAXAttributes::getName(), and SUMOSAXAttributes::hasAttribute().

Referenced by NIImporter_SUMO::addConnection(), NLHandler::addConnection(), NIXMLEdgesHandler::addEdge(), NIXMLEdgesHandler::addLane(), NLHandler::addLogicItem(), NLHandler::addRequest(), MSRouteHandler::addStop(), NIImporter_SUMO::addSuccLane(), NLHandler::addSuccLane(), SUMOSAXAttributes::getSUMOTimeReporting(), NIXMLTypesHandler::myStartElement(), NIImporter_MATSim::EdgesHandler::myStartElement(), NIImporter_OpenDrive::myStartElement(), RORDGenerator_ODAmounts::parseFlowAmountDef(), SUMOVehicleParserHelper::parseFlowAttributes(), NIXMLConnectionsHandler::parseLaneDefinition(), AGActivityGenHandler::parseStation(), SUMOVehicleParserHelper::parseVehicleAttributes(), NIXMLTrafficLightsHandler::removeTlConnection(), NIXMLTrafficLightsHandler::retrieveLaneIndex(), and RORDLoader_SUMOBase::startAlternative().

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>::_2intSec. If the attribute is empty, TplConvert<XMLCh>::_2intSec throws an EmptyData-exception which is passed. If the attribute==0, TplConvert<XMLCh>::_2intSec returns the default value. If the value can not be parsed to an int, TplConvert<XMLCh>::_2intSec throws a NumberFormatException-exception which is passed.

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 an int, if it could be read and parsed
Exceptions:
EmptyDataIf the attribute value is an empty string
NumberFormatExceptionIf the attribute value can not be parsed to an int

Implements SUMOSAXAttributes.

Definition at line 93 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvertSec< E >::_2intSec().

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

Implements SUMOSAXAttributes.

Definition at line 100 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert< E >::_2long().

long SUMOSAXAttributes::getLongReporting ( int  attr,
const char *  objectid,
bool ok,
bool  report = true 
) const [inherited]

Tries to read given attribute assuming it is a long.

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 108 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::emitEmptyError(), SUMOSAXAttributes::emitFormatError(), SUMOSAXAttributes::emitUngivenError(), SUMOSAXAttributes::getLong(), SUMOSAXAttributes::getName(), and SUMOSAXAttributes::hasAttribute().

Referenced by PCLoaderOSM::NodesHandler::myStartElement(), PCLoaderOSM::EdgesHandler::myStartElement(), NIImporter_OpenStreetMap::NodesHandler::myStartElement(), and NIImporter_OpenStreetMap::EdgesHandler::myStartElement().

std::string SUMOSAXAttributesImpl_Xerces::getName ( int  attr) const [virtual]

Converts the given attribute id into a man readable string.

Returns a "?" if the attribute is not known.

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

Implements SUMOSAXAttributes.

Definition at line 190 of file SUMOSAXAttributesImpl_Xerces.cpp.

References myPredefinedTagsMML.

bool SUMOSAXAttributes::getOptBoolReporting ( int  attr,
const char *  objectid,
bool ok,
bool  defaultValue,
bool  report = true 
) const [inherited]

Tries to read given attribute assuming it is a boolean.

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 a boolean), "ok" is set to false. If report is true an error message is written to MsgHandler::getErrorInstance.

Otherwise, "ok" is not changed.

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; false if an error occured

Definition at line 208 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::emitEmptyError(), SUMOSAXAttributes::emitFormatError(), SUMOSAXAttributes::getBool(), SUMOSAXAttributes::getName(), and SUMOSAXAttributes::hasAttribute().

Referenced by NLHandler::addE1Detector(), NLHandler::addE2Detector(), NLHandler::addE3Entry(), NLHandler::addE3Exit(), NIXMLEdgesHandler::addEdge(), NLHandler::addEdgeLaneMeanData(), NLHandler::addInstantE1Detector(), NLHandler::addLogicItem(), NLHandler::addPoly(), NLHandler::addRequest(), MSRouteHandler::addStop(), NLHandler::addWAUTJunction(), GUISettingsHandler::myStartElement(), PCTypeDefHandler::myStartElement(), NIXMLTypesHandler::myStartElement(), SUMOVehicleParserHelper::parseCommonAttributes(), and NIXMLConnectionsHandler::parseLaneBound().

int SUMOSAXAttributes::getOptIntReporting ( int  attr,
const char *  objectid,
bool ok,
int  defaultValue,
bool  report = true 
) const [inherited]

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 86 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::emitEmptyError(), SUMOSAXAttributes::emitFormatError(), SUMOSAXAttributes::getInt(), SUMOSAXAttributes::getName(), and SUMOSAXAttributes::hasAttribute().

Referenced by NIImporter_SUMO::addEdge(), NLHandler::addLane(), NLHandler::addPOI(), NLHandler::addPoly(), NIXMLTrafficLightsHandler::addTlConnection(), SUMOSAXAttributes::getOptSUMOTimeReporting(), PCTypeDefHandler::myStartElement(), and NIXMLTypesHandler::myStartElement().

std::string SUMOSAXAttributes::getOptStringReporting ( int  attr,
const char *  objectid,
bool ok,
const std::string &  defaultValue,
bool  report = true 
) const [inherited]

Tries to read given attribute assuming it is a string.

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), "ok" is set to false. If report is true an error message is written to MsgHandler::getErrorInstance.

Otherwise, "ok" is not changed.

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 not empty; the default value if the attribute does not exist; "" if an error occured

Definition at line 256 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::emitEmptyError(), SUMOSAXAttributes::getName(), SUMOSAXAttributes::getString(), and SUMOSAXAttributes::hasAttribute().

Referenced by NLDiscreteEventBuilder::addAction(), NIImporter_SUMO::addConnection(), NLHandler::addConnection(), NLHandler::addE2Detector(), NIImporter_SUMO::addEdge(), NIXMLEdgesHandler::addEdge(), NLHandler::addEdgeLaneMeanData(), NIImporter_SUMO::addLane(), NLHandler::addLane(), NIXMLEdgesHandler::addLane(), NIXMLNodesHandler::addNode(), NLHandler::addPOI(), NLHandler::addPoly(), NIImporter_SUMO::addProhibition(), NIXMLEdgesHandler::addSplit(), MSRouteHandler::addStop(), NIImporter_SUMO::addSuccLane(), NLHandler::addSuccLane(), NIXMLTrafficLightsHandler::addTlConnection(), NLHandler::addWAUTJunction(), NLHandler::beginEdgeParsing(), NLDiscreteEventBuilder::buildSaveTLStateCommand(), NLDiscreteEventBuilder::buildSaveTLSwitchesCommand(), NLDiscreteEventBuilder::buildSaveTLSwitchStatesCommand(), RORDLoader_TripDefs::getVehicleID(), NIImporter_SUMO::initTrafficLightLogic(), NIXMLTrafficLightsHandler::initTrafficLightLogic(), NLHandler::initTrafficLightLogic(), GUISettingsHandler::myStartElement(), RODFDetectorHandler::myStartElement(), PCTypeDefHandler::myStartElement(), NIXMLConnectionsHandler::myStartElement(), NIXMLTypesHandler::myStartElement(), PCLoaderXML::myStartElement(), PCNetProjectionLoader::myStartElement(), PCLoaderOSM::NodesHandler::myStartElement(), NIImporter_MATSim::EdgesHandler::myStartElement(), SAXWeightsHandler::myStartElement(), NIImporter_OpenStreetMap::NodesHandler::myStartElement(), NLHandler::openJunction(), MSRouteHandler::openRoute(), SUMOVehicleParserHelper::parseEmissionClass(), SUMOVehicleParserHelper::parseGuiShape(), RONetHandler::parseLane(), SUMOVehicleParserHelper::parseVehicleClass(), NIXMLNodesHandler::processTrafficLightDefinitions(), NIXMLEdgesHandler::tryGetLaneSpread(), and NIXMLEdgesHandler::tryGetShape().

SUMOReal SUMOSAXAttributes::getOptSUMORealReporting ( int  attr,
const char *  objectid,
bool ok,
SUMOReal  defaultValue,
bool  report = true 
) const [inherited]

Tries to read given attribute assuming it is a SUMOReal.

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.

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 160 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::emitEmptyError(), SUMOSAXAttributes::emitFormatError(), SUMOSAXAttributes::getFloat(), SUMOSAXAttributes::getName(), SUMOSAXAttributes::hasAttribute(), and SUMOReal.

Referenced by NLHandler::addConnection(), NLHandler::addE2Detector(), NIImporter_SUMO::addEdge(), NIXMLEdgesHandler::addEdge(), NLHandler::addEdgeLaneMeanData(), NIImporter_SUMO::addLane(), NLHandler::addLane(), NLHandler::addPOI(), MSRouteHandler::addStop(), NLHandler::addSuccLane(), NLHandler::beginE3Detector(), GUISettingsHandler::myStartElement(), MSRouteHandler::myStartElement(), NIXMLTypesHandler::myStartElement(), MSLaneSpeedTrigger::myStartElement(), MSTriggeredRerouter::myStartElement(), MSRouteHandler::openRoute(), RORDLoader_SUMOBase::startRoute(), and NIXMLEdgesHandler::tryGetPosition().

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

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 getIntReporting or getSUMORealReporting 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 304 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::emitEmptyError(), SUMOSAXAttributes::emitFormatError(), SUMOSAXAttributes::getFloat(), SUMOSAXAttributes::getName(), SUMOSAXAttributes::getOptIntReporting(), and SUMOSAXAttributes::hasAttribute().

Referenced by NLHandler::addE2Detector(), NLHandler::addEdgeLaneMeanData(), NLHandler::addPhase(), NLHandler::addRouteProbeDetector(), MSRouteHandler::addStop(), NLHandler::beginE3Detector(), NLHandler::initTrafficLightLogic(), GUISettingsHandler::myStartElement(), MSRouteHandler::myStartElement(), RORDGenerator_ODAmounts::myStartElement(), MSTriggeredRerouter::myStartElement(), NLHandler::openWAUT(), and RORDGenerator_ODAmounts::parseFlowAmountDef().

std::string SUMOSAXAttributesImpl_Xerces::getString ( int  id) const throw (EmptyData) [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

Implements SUMOSAXAttributes.

Definition at line 106 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert< E >::_2str().

Referenced by GenericSAXHandler::startElement().

std::string SUMOSAXAttributes::getStringReporting ( int  attr,
const char *  objectid,
bool ok,
bool  report = true 
) const [inherited]

Tries to read given attribute assuming it is a string.

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

Otherwise, "ok" is not changed.

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 not empty; "" if an error occured

Definition at line 230 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::emitEmptyError(), SUMOSAXAttributes::emitUngivenError(), SUMOSAXAttributes::getName(), SUMOSAXAttributes::getString(), and SUMOSAXAttributes::hasAttribute().

Referenced by NIImporter_SUMO::addConnection(), NLHandler::addConnection(), 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(), NLHandler::addLogicItem(), NIXMLNodesHandler::addNode(), NLHandler::addParam(), NIImporter_SUMO::addPhase(), NLHandler::addPhase(), NLHandler::addPOI(), NLHandler::addPoly(), NLHandler::addRequest(), NLHandler::addRouteProbeDetector(), NIImporter_SUMO::addSuccEdge(), NIImporter_SUMO::addSuccLane(), NLHandler::addSuccLane(), ROJTRTurnDefLoader::addToEdge(), NLHandler::addVTypeProbeDetector(), NLHandler::addWAUTJunction(), NLHandler::addWAUTSwitch(), NLHandler::beginE3Detector(), NLHandler::beginEdgeParsing(), ROJTRTurnDefLoader::beginFromEdge(), SUMOVehicleParserHelper::beginVTypeParsing(), NLTriggerBuilder::buildVaporizer(), NIXMLEdgesHandler::deleteEdge(), NIXMLNodesHandler::deleteNode(), RORDLoader_TripDefs::getEdge(), NLHandler::initJunctionLogic(), NIImporter_SUMO::initTrafficLightLogic(), NIXMLTrafficLightsHandler::initTrafficLightLogic(), NLHandler::initTrafficLightLogic(), NIImporter_SUMO::loadLocation(), GUISettingsHandler::myStartElement(), RODFDetectorHandler::myStartElement(), PCTypeDefHandler::myStartElement(), NIXMLConnectionsHandler::myStartElement(), MSRouteHandler::myStartElement(), NIXMLTypesHandler::myStartElement(), ROJTRTurnDefLoader::myStartElement(), PCLoaderXML::myStartElement(), NIImporter_MATSim::NodesHandler::myStartElement(), PCLoaderOSM::NodesHandler::myStartElement(), NIImporter_MATSim::EdgesHandler::myStartElement(), PCLoaderOSM::EdgesHandler::myStartElement(), NIImporter_OpenStreetMap::NodesHandler::myStartElement(), NIImporter_OpenStreetMap::EdgesHandler::myStartElement(), NIImporter_OpenDrive::myStartElement(), ODDistrictHandler::openDistrict(), NLHandler::openJunction(), MSRouteHandler::openRoute(), MSRouteHandler::openRouteDistribution(), NLHandler::openSucc(), MSRouteHandler::openVehicleTypeDistribution(), NLHandler::openWAUT(), SUMOVehicleParserHelper::parseCommonAttributes(), RONetHandler::parseConnectedEdge(), RONetHandler::parseConnectingEdge(), RONetHandler::parseConnection(), ODDistrictHandler::parseConnection(), NIXMLConnectionsHandler::parseDeprecatedLaneDefinition(), RONetHandler::parseDistrict(), RONetHandler::parseDistrictEdge(), RONetHandler::parseEdge(), SUMOVehicleParserHelper::parseFlowAttributes(), RONetHandler::parseJunction(), RONetHandler::parseLane(), SUMOVehicleParserHelper::parseVehicleAttributes(), NIXMLNodesHandler::processTrafficLightDefinitions(), NIXMLTrafficLightsHandler::removeTlConnection(), NIXMLTrafficLightsHandler::retrieveEdge(), NLHandler::setLocation(), NIXMLEdgesHandler::setNodes(), RORDLoader_SUMOBase::startAlternative(), RORDLoader_SUMOBase::startRoute(), and NIXMLEdgesHandler::tryGetLaneSpread().

std::string SUMOSAXAttributesImpl_Xerces::getStringSecure ( int  id,
const std::string &  def 
) const throw (EmptyData) [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

Implements SUMOSAXAttributes.

Definition at line 123 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvertSec< E >::_2strSec().

std::string SUMOSAXAttributesImpl_Xerces::getStringSecure ( const std::string &  id,
const std::string &  def 
) const [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

Implements SUMOSAXAttributes.

Definition at line 180 of file SUMOSAXAttributesImpl_Xerces.cpp.

References myAttrs.

SUMOReal SUMOSAXAttributes::getSUMORealReporting ( int  attr,
const char *  objectid,
bool ok,
bool  report = true 
) const [inherited]

Tries to read given attribute assuming it is a SUMOReal.

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.

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 134 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::emitEmptyError(), SUMOSAXAttributes::emitFormatError(), SUMOSAXAttributes::emitUngivenError(), SUMOSAXAttributes::getFloat(), SUMOSAXAttributes::getName(), SUMOSAXAttributes::hasAttribute(), and SUMOReal.

Referenced by NLHandler::addE1Detector(), NLHandler::addE2Detector(), NLHandler::addE3Entry(), NLHandler::addE3Exit(), NIXMLEdgesHandler::addEdge(), NLHandler::addInstantE1Detector(), NIImporter_SUMO::addLane(), NLHandler::addLane(), NIXMLEdgesHandler::addLane(), NIXMLNodesHandler::addNode(), NIImporter_SUMO::addPhase(), NIXMLEdgesHandler::addSplit(), ROJTRTurnDefLoader::addToEdge(), SUMOVehicleParserHelper::beginVTypeParsing(), NIImporter_SUMO::initTrafficLightLogic(), NIXMLTrafficLightsHandler::initTrafficLightLogic(), GUISettingsHandler::myStartElement(), RODFDetectorHandler::myStartElement(), PCLoaderXML::myStartElement(), NIImporter_MATSim::NodesHandler::myStartElement(), PCLoaderOSM::NodesHandler::myStartElement(), NIImporter_MATSim::EdgesHandler::myStartElement(), SAXWeightsHandler::myStartElement(), NIImporter_OpenDrive::myStartElement(), NLHandler::openJunction(), ODDistrictHandler::parseConnection(), SUMOVehicleParserHelper::parseFlowAttributes(), RONetHandler::parseJunction(), RONetHandler::parseLane(), SUMOVehicleParserHelper::parseVehicleAttributes(), SUMOVehicleParserHelper::parseVTypeEmbedded(), NIImporter_SUMO::readPosition(), and RORDLoader_SUMOBase::startRoute().

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

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 getIntReporting or getSUMORealReporting 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 274 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::emitEmptyError(), SUMOSAXAttributes::emitFormatError(), SUMOSAXAttributes::emitUngivenError(), SUMOSAXAttributes::getFloat(), SUMOSAXAttributes::getIntReporting(), SUMOSAXAttributes::getName(), and SUMOSAXAttributes::hasAttribute().

Referenced by NLHandler::addE1Detector(), NLHandler::addE2Detector(), NLHandler::addPhase(), NLHandler::addRouteProbeDetector(), NLHandler::addVTypeProbeDetector(), NLHandler::addWAUTSwitch(), NLHandler::beginE3Detector(), NLTriggerBuilder::buildVaporizer(), RORDLoader_TripDefs::myStartElement(), ROJTRTurnDefLoader::myStartElement(), MSLaneSpeedTrigger::myStartElement(), SUMOVehicleParserHelper::parseFlowAttributes(), and SUMOVehicleParserHelper::parseVehicleAttributes().

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

Parameters:
[in]idThe id of the searched attribute
Returns:
Whether the attribute is within the attributes

Implements SUMOSAXAttributes.

Definition at line 65 of file SUMOSAXAttributesImpl_Xerces.cpp.

References myAttrs, and myPredefinedTags.

bool SUMOSAXAttributesImpl_Xerces::hasAttribute ( const std::string &  id) const [virtual]

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

Implements SUMOSAXAttributes.

Definition at line 171 of file SUMOSAXAttributesImpl_Xerces.cpp.

References myAttrs.

SUMOSAXAttributesImpl_Xerces& SUMOSAXAttributesImpl_Xerces::operator= ( const SUMOSAXAttributesImpl_Xerces src) [private]

Invalidated assignment operator.

void SUMOSAXAttributes::parseStringVector ( const std::string &  def,
std::vector< std::string > &  into 
) [static, inherited]

Splits the given string.

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 vector to fill

Definition at line 381 of file SUMOSAXAttributes.cpp.

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

Referenced by NIXMLEdgesHandler::addSplit(), NLTriggerBuilder::parseAndBuildBusStop(), NLTriggerBuilder::parseAndBuildLaneSpeedTrigger(), NLTriggerBuilder::parseAndBuildRerouter(), and NIXMLNodesHandler::processTrafficLightDefinitions().


Field Documentation

const Attributes& SUMOSAXAttributesImpl_Xerces::myAttrs [private]

The encapsulated attributes.

Definition at line 306 of file SUMOSAXAttributesImpl_Xerces.h.

Referenced by getAttributeValueSecure(), getStringSecure(), and hasAttribute().

Map of attribute ids to their xerces-representation.

Definition at line 311 of file SUMOSAXAttributesImpl_Xerces.h.

Referenced by getAttributeValueSecure(), and hasAttribute().

const std::map<int, std::string>& SUMOSAXAttributesImpl_Xerces::myPredefinedTagsMML [private]

Map of attribute ids to their (readable) string-representation.

Definition at line 314 of file SUMOSAXAttributesImpl_Xerces.h.

Referenced by getName().


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