42 #ifdef CHECK_MEMORY_LEAKS 44 #endif // CHECK_MEMORY_LEAKS 55 : myAttributeName(attributeName), myAmEdgeBased(edgeBased), myDestination(destination) {
67 const std::string& file)
73 const std::string& file)
81 std::vector<ToRetrieveDefinition*>::iterator i;
116 std::vector<ToRetrieveDefinition*>::iterator i;
120 if ((*i)->myAmEdgeBased) {
122 (*i)->myAggValue = attrs.
getFloat((*i)->myAttributeName);
124 (*i)->myHadAttribute =
true;
126 (*i)->myHadAttribute =
false;
129 (*i)->myAggValue = 0;
136 if (!(*i)->myAmEdgeBased) {
138 (*i)->myAggValue += attrs.
getFloat((*i)->myAttributeName);
140 (*i)->myHadAttribute =
true;
155 std::vector<ToRetrieveDefinition*>::iterator i;
157 if ((*i)->myHadAttribute) {
159 (*i)->myAggValue / (
SUMOReal)(*i)->myNoLanes,
Interface for a class which obtains read weights for named edges.
SUMOReal myCurrentTimeBeg
the begin of the time period that is currently processed
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
SAX-handler base for SUMO-files.
~SAXWeightsHandler()
Destructor.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
std::string myCurrentEdgeID
the edge which is currently being processed
SUMOReal myCurrentTimeEnd
the end of the time period that is currently processed
void tryParse(const SUMOSAXAttributes &attrs, bool isEdge)
Parses the efforts of a lane for the previously read times.
Encapsulated SAX-Attributes.
virtual SUMOReal getFloat(int id) const =0
Returns the SUMOReal-value of the named (by its enum-value) attribute.
void myEndElement(int elemente)
Called when a closing tag occurs.
std::vector< ToRetrieveDefinition * > myDefinitions
List of definitions what shall be read and whereto stored while parsing the file. ...
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Complete definition about what shall be retrieved and where to store it.
ToRetrieveDefinition(const std::string &attributeName, bool edgeBased, EdgeFloatTimeLineRetriever &destination)
Constructor.
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.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
~ToRetrieveDefinition()
Destructor.
SAXWeightsHandler(const std::vector< ToRetrieveDefinition * > &defs, const std::string &file)
Constructor.