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

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<>
SUMOLong 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...
 
 SUMOSAXAttributesImpl_Xerces (const XERCES_CPP_NAMESPACE::Attributes &attrs, const std::map< int, XMLCh * > &predefinedTags, const std::map< int, std::string > &predefinedTagsMML, const std::string &objectType)
 Constructor. More...
 
virtual ~SUMOSAXAttributesImpl_Xerces ()
 Destructor. More...
 

virtual methods for retrieving attribute values

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

methods for retrieving attribute values

typedef std::map< int, XMLCh * > AttrMap
 Definition of a map of attribute ids to their xerces-representation. More...
 
const XERCES_CPP_NAMESPACE::Attributes & myAttrs
 The encapsulated attributes. More...
 
const AttrMapmyPredefinedTags
 Map of attribute ids to their xerces-representation. More...
 
const std::map< int, std::string > & myPredefinedTagsMML
 Map of attribute ids to their (readable) string-representation. More...
 
bool hasAttribute (int id) const
 Returns the information whether the named (by its enum-value) attribute is within the current list. More...
 
bool getBool (int id) const
 Returns the bool-value of the named (by its enum-value) attribute. More...
 
int getInt (int id) const
 Returns the int-value of the named (by its enum-value) attribute. More...
 
SUMOLong getLong (int id) const
 Returns the long-value of the named (by its enum-value) attribute. More...
 
std::string getString (int id) const
 Returns the string-value of the named (by its enum-value) attribute. More...
 
std::string getStringSecure (int id, const std::string &def) const
 Returns the string-value of the named (by its enum-value) attribute. More...
 
SUMOReal getFloat (int id) const
 Returns the SUMOReal-value of the named (by its enum-value) attribute. More...
 
bool hasAttribute (const std::string &id) const
 Returns the information whether the named attribute is within the current list. More...
 
SUMOReal getFloat (const std::string &id) const
 Returns the SUMOReal-value of the named attribute. More...
 
std::string getStringSecure (const std::string &id, const std::string &def) const
 Returns the string-value of the named (by its enum-value) attribute. More...
 
SumoXMLEdgeFunc getEdgeFunc (bool &ok) const
 Returns the value of the named attribute. More...
 
SumoXMLNodeType getNodeType (bool &ok) const
 Returns the value of the named attribute. More...
 
RGBColor getColor () const
 Returns the value of the named attribute. More...
 
PositionVector getShape (int attr) const
 Tries to read given attribute assuming it is a PositionVector. More...
 
Boundary getBoundary (int attr) const
 Tries to read given attribute assuming it is a Boundary. More...
 
std::vector< std::string > getStringVector (int attr) const
 Tries to read given attribute assuming it is a string vector. More...
 
std::string getName (int attr) const
 Converts the given attribute id into a man readable string. More...
 
void serialize (std::ostream &os) const
 Prints all attribute names and values into the given stream. More...
 
const XMLCh * getAttributeValueSecure (int id) const
 Returns Xerces-value of the named attribute. More...
 
 SUMOSAXAttributesImpl_Xerces (const SUMOSAXAttributesImpl_Xerces &src)
 Invalidated copy constructor. More...
 
SUMOSAXAttributesImpl_Xercesoperator= (const SUMOSAXAttributesImpl_Xerces &src)
 Invalidated assignment operator. More...
 

Detailed Description

Encapsulated Xerces-SAX-attributes.

See also
SUMOSAXAttributes

Definition at line 53 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 305 of file SUMOSAXAttributesImpl_Xerces.h.

Constructor & Destructor Documentation

SUMOSAXAttributesImpl_Xerces::SUMOSAXAttributesImpl_Xerces ( const XERCES_CPP_NAMESPACE::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 54 of file SUMOSAXAttributesImpl_Xerces.cpp.

SUMOSAXAttributesImpl_Xerces::~SUMOSAXAttributesImpl_Xerces ( )
virtual

Destructor.

Definition at line 64 of file SUMOSAXAttributesImpl_Xerces.cpp.

SUMOSAXAttributesImpl_Xerces::SUMOSAXAttributesImpl_Xerces ( const SUMOSAXAttributesImpl_Xerces src)
private

Invalidated copy constructor.

Member Function Documentation

void SUMOSAXAttributes::emitEmptyError ( const std::string &  attrname,
const char *  objectid 
) const
protectedinherited
void SUMOSAXAttributes::emitFormatError ( const std::string &  attrname,
const std::string &  type,
const char *  objectid 
) const
protectedinherited
void SUMOSAXAttributes::emitUngivenError ( const std::string &  attrname,
const char *  objectid 
) const
protectedinherited
template<typename T >
T SUMOSAXAttributes::get ( 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 443 of file SUMOSAXAttributes.h.

References SUMOSAXAttributes::emitEmptyError(), SUMOSAXAttributes::emitFormatError(), SUMOSAXAttributes::emitUngivenError(), SUMOSAXAttributes::getName(), and SUMOSAXAttributes::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(), 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(), NIXMLConnectionsHandler::myStartElement(), NIXMLTypesHandler::myStartElement(), MSRouteHandler::myStartElement(), ROJTRTurnDefLoader::myStartElement(), PCNetProjectionLoader::myStartElement(), TrajectoriesHandler::myStartElement(), PCLoaderXML::myStartElement(), NIImporter_MATSim::NodesHandler::myStartElement(), PCLoaderOSM::NodesHandler::myStartElement(), NIImporter_MATSim::EdgesHandler::myStartElement(), SAXWeightsHandler::myStartElement(), PCLoaderOSM::EdgesHandler::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(), NLHandler::openWAUT(), NLTriggerBuilder::parseAndBuildBusStop(), NLTriggerBuilder::parseAndBuildCalibrator(), NLTriggerBuilder::parseAndBuildContainerStop(), NLTriggerBuilder::parseAndBuildLaneSpeedTrigger(), NLTriggerBuilder::parseAndBuildRerouter(), RONetHandler::parseBusStop(), SUMOVehicleParserHelper::parseCommonAttributes(), RONetHandler::parseConnection(), RONetHandler::parseContainerStop(), NIXMLConnectionsHandler::parseDeprecatedLaneDefinition(), RONetHandler::parseDistrict(), RONetHandler::parseDistrictEdge(), RONetHandler::parseEdge(), SUMOVehicleParserHelper::parseFlowAttributes(), RONetHandler::parseJunction(), RONetHandler::parseLane(), NIXMLConnectionsHandler::parseLaneDefinition(), AGActivityGenHandler::parseStation(), SUMORouteHandler::parseStop(), ODDistrictHandler::parseTAZ(), SUMOVehicleParserHelper::parseVehicleAttributes(), SUMOVehicleParserHelper::parseVTypeEmbedded(), NIImporter_SUMO::readPosition(), NIXMLTrafficLightsHandler::removeTlConnection(), NIXMLTrafficLightsHandler::retrieveEdge(), NIXMLTrafficLightsHandler::retrieveLaneIndex(), RORouteHandler::routePedestrian(), NLHandler::setLocation(), and NIXMLEdgesHandler::setNodes().

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 152 of file SUMOSAXAttributesImpl_Xerces.cpp.

References myAttrs, and myPredefinedTags.

Referenced by getBool(), getFloat(), getInt(), getLong(), getString(), and getStringSecure().

bool SUMOSAXAttributesImpl_Xerces::getBool ( int  id) const
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

Implements SUMOSAXAttributes.

Definition at line 79 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert::_2bool(), and getAttributeValueSecure().

Boundary SUMOSAXAttributesImpl_Xerces::getBoundary ( int  attr) const
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; "" if an error occured

Implements SUMOSAXAttributes.

Definition at line 242 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert::_2SUMOReal(), getString(), StringTokenizer::next(), StringTokenizer::size(), and SUMOReal.

RGBColor SUMOSAXAttributesImpl_Xerces::getColor ( ) const
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

Implements SUMOSAXAttributes.

Definition at line 214 of file SUMOSAXAttributesImpl_Xerces.cpp.

References getString(), RGBColor::parseColor(), and SUMO_ATTR_COLOR.

SumoXMLEdgeFunc SUMOSAXAttributesImpl_Xerces::getEdgeFunc ( bool ok) const
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 SumoXMLEdgeFunc, if it could be read and parsed

Implements SUMOSAXAttributes.

Definition at line 188 of file SUMOSAXAttributesImpl_Xerces.cpp.

References EDGEFUNC_NORMAL, SUMOXMLDefinitions::EdgeFunctions, StringBijection< T >::get(), getString(), hasAttribute(), and SUMO_ATTR_FUNCTION.

SUMOReal SUMOSAXAttributesImpl_Xerces::getFloat ( int  id) const
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

Implements SUMOSAXAttributes.

Definition at line 146 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert::_2SUMOReal(), and getAttributeValueSecure().

SUMOReal SUMOSAXAttributesImpl_Xerces::getFloat ( const std::string &  id) const
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 160 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert::_2SUMOReal(), myAttrs, and SUMOReal.

int SUMOSAXAttributesImpl_Xerces::getInt ( int  id) const
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

Implements SUMOSAXAttributes.

Definition at line 85 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert::_2int(), and getAttributeValueSecure().

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

Definition at line 196 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::getInt().

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

Definition at line 204 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::getLong().

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

Definition at line 212 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::getFloat().

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

Definition at line 220 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::getBool().

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

Definition at line 228 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::getString().

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

Definition at line 240 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::getColor().

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

Definition at line 248 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::getShape().

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

Definition at line 256 of file SUMOSAXAttributes.cpp.

References SUMOSAXAttributes::getBoundary().

template<typename T >
T SUMOSAXAttributes::getInternal ( const int  attr) const
protectedinherited
SUMOLong SUMOSAXAttributesImpl_Xerces::getLong ( int  id) const
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

Implements SUMOSAXAttributes.

Definition at line 91 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert::_2long(), and getAttributeValueSecure().

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 266 of file SUMOSAXAttributesImpl_Xerces.cpp.

References myPredefinedTagsMML.

SumoXMLNodeType SUMOSAXAttributesImpl_Xerces::getNodeType ( bool ok) const
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 SumoXMLNodeType, if it could be read and parsed

Implements SUMOSAXAttributes.

Definition at line 201 of file SUMOSAXAttributesImpl_Xerces.cpp.

References StringBijection< T >::get(), getString(), hasAttribute(), NODETYPE_UNKNOWN, SUMOXMLDefinitions::NodeTypes, and SUMO_ATTR_TYPE.

const std::string& SUMOSAXAttributes::getObjectType ( ) const
inlineinherited
template<typename T >
T SUMOSAXAttributes::getOpt ( int  attr,
const char *  objectid,
bool ok,
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 469 of file SUMOSAXAttributes.h.

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

Referenced by 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(), NIXMLNodesHandler::addNode(), 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(), NIXMLConnectionsHandler::myStartElement(), NIXMLTypesHandler::myStartElement(), MSRouteHandler::myStartElement(), MSCalibrator::myStartElement(), TrajectoriesHandler::myStartElement(), PCLoaderXML::myStartElement(), MSLaneSpeedTrigger::myStartElement(), PCLoaderOSM::NodesHandler::myStartElement(), MSTriggeredRerouter::myStartElement(), NIImporter_MATSim::EdgesHandler::myStartElement(), SAXWeightsHandler::myStartElement(), PCLoaderOSM::EdgesHandler::myStartElement(), NIImporter_OpenDrive::myStartElement(), NLHandler::openJunction(), MSRouteHandler::openRoute(), RORouteHandler::openRoute(), NLTriggerBuilder::parseAndBuildBusStop(), NLTriggerBuilder::parseAndBuildCalibrator(), NLTriggerBuilder::parseAndBuildContainerStop(), NLTriggerBuilder::parseAndBuildRerouter(), RONetHandler::parseBusStop(), SUMOVehicleParserHelper::parseCommonAttributes(), RONetHandler::parseContainerStop(), SUMOVehicleParserHelper::parseEmissionClass(), MSRouteHandler::parseFromViaTo(), RORouteHandler::parseFromViaTo(), AGActivityGenHandler::parseGeneralCityInfo(), SUMOVehicleParserHelper::parseGuiShape(), RONetHandler::parseLane(), NIXMLConnectionsHandler::parseLaneBound(), AGActivityGenHandler::parseParameters(), SUMORouteHandler::parseStop(), SUMOVehicleParserHelper::parseVehicleAttributes(), SUMOVehicleParserHelper::parseVehicleClass(), NIXMLNodesHandler::processTrafficLightDefinitions(), RORouteHandler::routePedestrian(), NIXMLEdgesHandler::tryGetLaneSpread(), and NIXMLEdgesHandler::tryGetShape().

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

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

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

PositionVector SUMOSAXAttributesImpl_Xerces::getShape ( int  attr) const
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; "" if an error occured

Implements SUMOSAXAttributes.

Definition at line 220 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert::_2SUMOReal(), getString(), StringTokenizer::hasNext(), StringTokenizer::next(), PositionVector::push_back(), and SUMOReal.

std::string SUMOSAXAttributesImpl_Xerces::getString ( int  id) const
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 97 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert::_2str(), and getAttributeValueSecure().

Referenced by getBoundary(), getColor(), getEdgeFunc(), getNodeType(), getShape(), getStringVector(), and GenericSAXHandler::startElement().

std::string SUMOSAXAttributesImpl_Xerces::getStringSecure ( int  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. 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 121 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert::_2strSec(), and getAttributeValueSecure().

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 178 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert::_2strSec(), and myAttrs.

std::vector< std::string > SUMOSAXAttributesImpl_Xerces::getStringVector ( int  attr) const
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

Implements SUMOSAXAttributes.

Definition at line 257 of file SUMOSAXAttributesImpl_Xerces.cpp.

References getString(), and SUMOSAXAttributes::parseStringVector().

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 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 SUMOSAXAttributes::emitEmptyError(), SUMOSAXAttributes::emitFormatError(), SUMOSAXAttributes::emitUngivenError(), SUMOSAXAttributes::getFloat(), SUMOSAXAttributes::getName(), SUMOSAXAttributes::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 RORouteHandler::routePedestrian().

bool SUMOSAXAttributesImpl_Xerces::hasAttribute ( int  id) const
virtual

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 69 of file SUMOSAXAttributesImpl_Xerces.cpp.

References myAttrs, and myPredefinedTags.

Referenced by getEdgeFunc(), and getNodeType().

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 169 of file SUMOSAXAttributesImpl_Xerces.cpp.

References myAttrs.

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

Invalidated assignment operator.

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

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

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

Referenced by SUMORouteHandler::parseStop().

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

Prints all attribute names and values into the given stream.

Parameters
[in]osThe stream to use

Implements SUMOSAXAttributes.

Definition at line 275 of file SUMOSAXAttributesImpl_Xerces.cpp.

References TplConvert::_2str(), and myAttrs.

Field Documentation

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

The encoding of parsed strings.

Definition at line 382 of file SUMOSAXAttributes.h.

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

const XERCES_CPP_NAMESPACE::Attributes& SUMOSAXAttributesImpl_Xerces::myAttrs
private

The encapsulated attributes.

Definition at line 302 of file SUMOSAXAttributesImpl_Xerces.h.

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

const AttrMap& SUMOSAXAttributesImpl_Xerces::myPredefinedTags
private

Map of attribute ids to their xerces-representation.

Definition at line 307 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 310 of file SUMOSAXAttributesImpl_Xerces.h.

Referenced by getName().


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