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::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; }
int SUMOSAXAttributes::getIntReporting(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 getInt(attr); } catch (NumberFormatException &) { if (report) { emitFormatError(getName(attr), "an int", objectid); } } catch (EmptyData &) { if (report) { emitEmptyError(getName(attr), objectid); } } ok = false; return -1; }
std::string SUMOSAXAttributes::getStringReporting(int attr, const char *objectid, bool &ok, bool report) const throw() { if (!hasAttribute(attr)) { if (report) { emitUngivenError(getName(attr), objectid); } ok = false; return ""; } try { std::string ret = getString(attr); if (ret=="") { throw EmptyData(); } return ret; } catch (EmptyData &) { if (report) { emitEmptyError(getName(attr), objectid); } } ok = false; return ""; }
bool SUMOSAXAttributes::getBoolReporting(int attr, const char *objectid, bool &ok, bool report) const throw() { if (!hasAttribute(attr)) { if (report) { emitUngivenError(getName(attr), objectid); } ok = false; return false; } 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; }