X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/cfb9d01b612672ececbff08a9fecef3d91aad7a4..58a6a9307ec328557fb80333cf4631ead71e4ebd:/src/surf/xml/surfxml_sax_cb.cpp diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 1afc67e4d1..13de767561 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -118,9 +118,12 @@ int surf_parse_get_int(std::string s) return -1; } } +} + +namespace { /* Turn something like "1-4,6,9-11" into the vector {1,2,3,4,6,9,10,11} */ -static std::vector* explodesRadical(std::string radicals) +std::vector* explodesRadical(std::string radicals) { std::vector* exploded = new std::vector(); @@ -151,7 +154,6 @@ static std::vector* explodesRadical(std::string radicals) return exploded; } -namespace { class unit_scale : public std::unordered_map { public: using std::unordered_map::unordered_map; @@ -189,11 +191,10 @@ unit_scale::unit_scale(std::initializer_listsecond; } +} + +extern "C" { double surf_parse_get_time(const char* string, const char* entity_kind, std::string name) { - static const unit_scale units{{"w", 7 * 24 * 60 * 60}, - {"d", 24 * 60 * 60}, - {"h", 60 * 60}, - {"m", 60}, - {"s", 1.0}, - {"ms", 1e-3}, - {"us", 1e-6}, - {"ns", 1e-9}, - {"ps", 1e-12}}; + static const unit_scale units{std::make_pair("w", 7 * 24 * 60 * 60), + std::make_pair("d", 24 * 60 * 60), + std::make_pair("h", 60 * 60), + std::make_pair("m", 60), + std::make_pair("s", 1.0), + std::make_pair("ms", 1e-3), + std::make_pair("us", 1e-6), + std::make_pair("ns", 1e-9), + std::make_pair("ps", 1e-12)}; return surf_parse_get_value_with_unit(string, units, entity_kind, name, "Append 's' to your time to get seconds", "s"); }