SUMOTime SUMOSAXAttributes::getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report) const throw() { #ifdef HAVE_SUBSECOND_TIMESTEPS if (!hasAttribute(attr)) { if (report) { emitUngivenError(getName(attr), objectid); } ok = false; return -1; } try { return (SUMOTime)(getFloat(attr) * 1000.); } catch (NumberFormatException &) { if (report) { emitFormatError(getName(attr), "a time value", objectid); } } catch (EmptyData &) { if (report) { emitEmptyError(getName(attr), objectid); } } ok = false; return (SUMOTime) -1; #else return getIntReporting(attr, objectid, ok, report); #endif }
SUMOTime SUMOSAXAttributes::getOptSUMOTimeReporting(int attr, const char* objectid, bool& ok, SUMOTime defaultValue, bool report) const { if (!hasAttribute(attr)) { return defaultValue; } try { return (SUMOTime)(getFloat(attr) * 1000.); } catch (NumberFormatException&) { if (report) { emitFormatError(getName(attr), "a real number", objectid); } } catch (EmptyData&) { if (report) { emitEmptyError(getName(attr), objectid); } } ok = false; return (SUMOTime) - 1; }
int SUMOSAXAttributes::getOptIntReporting(int attr, const char *objectid, bool &ok, int defaultValue, bool report) const throw() { if (!hasAttribute(attr)) { return defaultValue; } try { return getInt(attr); } catch (NumberFormatException &) { if (report) { emitFormatError(getName(attr), "an int", objectid); } } catch (EmptyData &) { if (report) { emitEmptyError(getName(attr), objectid); } } ok = false; return -1; }
bool SUMOSAXAttributes::getOptBoolReporting(int attr, const char *objectid, bool &ok, bool defaultValue, bool report) const throw() { if (!hasAttribute(attr)) { return defaultValue; } try { return getBool(attr); } catch (BoolFormatException &) { if (report) { emitFormatError(getName(attr), "a boolean", objectid); } } catch (EmptyData &) { if (report) { emitEmptyError(getName(attr), objectid); } } ok = false; return false; }
SUMOTime SUMOSAXAttributes::getSUMOTimeReporting(int attr, const char* objectid, bool& ok, bool report) const { if (!hasAttribute(attr)) { if (report) { emitUngivenError(getName(attr), objectid); } ok = false; return -1; } try { return TIME2STEPS(getFloat(attr)); } catch (NumberFormatException&) { if (report) { emitFormatError(getName(attr), "a time value", objectid); } } catch (EmptyData&) { if (report) { emitEmptyError(getName(attr), objectid); } } ok = false; return (SUMOTime) - 1; }
SUMOReal SUMOSAXAttributes::getSUMORealReporting(int attr, const char *objectid, bool &ok, bool report) const throw() { if (!hasAttribute(attr)) { if (report) { emitUngivenError(getName(attr), objectid); } ok = false; return -1; } try { return getFloat(attr); } catch (NumberFormatException &) { if (report) { emitFormatError(getName(attr), "a real number", objectid); } } catch (EmptyData &) { if (report) { emitEmptyError(getName(attr), objectid); } } ok = false; return (SUMOReal) -1; }