- Fixed bug in serialization which caused threads to be saved with a "lats-for" field of 0
- Added some comments to the string_to code git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@956 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
2497aa3bc6
commit
8b7a4ed569
|
@ -228,8 +228,8 @@ void XMLVisitor::from_thread(xmlNodePtr parent, const Thread& obj) throw(Seriali
|
|||
Glib::ustring strLastsTime;
|
||||
to_string<int>(obj.get_base_priority(), strPriority);
|
||||
to_string<int>(obj.get_arrival_time(), strArrivalTime);
|
||||
to_string<int>(obj.get_elapsed_time(), strLastsTime);
|
||||
// get_elapsed_time() or get_total_cpu_time() ???
|
||||
to_string<int>(obj.get_total_cpu_time(), strLastsTime);
|
||||
|
||||
xmlNodePtr thread_node = xmlNewChild(parent, NULL, (const xmlChar *) "thread", NULL);
|
||||
xmlNewProp(thread_node, (const xmlChar *) "name", (const xmlChar *) obj.get_name().c_str());
|
||||
xmlNewProp(thread_node, (const xmlChar *) "priority", (const xmlChar *) strPriority.c_str());
|
||||
|
|
|
@ -51,6 +51,8 @@ namespace sgpem
|
|||
if (tokens.size() != 1)
|
||||
throw domain_error(_("too few or too many tokens"));
|
||||
|
||||
// use the token, not the string, so whitespaces at the end of the string are
|
||||
// not considered errors by the last test
|
||||
istringstream iss(tokens[0]);
|
||||
T result;
|
||||
|
||||
|
@ -65,10 +67,10 @@ namespace sgpem
|
|||
throw domain_error(e.what());
|
||||
}
|
||||
|
||||
// disable exceptions, otherwise peek() will throw them!
|
||||
// how useless!!!
|
||||
// disable exceptions, otherwise peek() will throw them on eof!
|
||||
iss.exceptions(ios_base::goodbit);
|
||||
|
||||
// check if there is still stuff in the stream, there shouldn't
|
||||
if (iss.peek() != istringstream::traits_type::eof())
|
||||
throw domain_error(_("incorrect number format"));
|
||||
|
||||
|
@ -85,6 +87,8 @@ namespace sgpem
|
|||
if (tokens.size() != 1)
|
||||
throw domain_error(_("too few or too many tokens"));
|
||||
|
||||
// use the token, not the string, so whitespaces at the end of the string are
|
||||
// not considered errors by the last test
|
||||
istringstream iss(tokens[0]);
|
||||
bool value;
|
||||
|
||||
|
@ -99,10 +103,10 @@ namespace sgpem
|
|||
throw domain_error(e.what());
|
||||
}
|
||||
|
||||
// disable exceptions, otherwise peek() will throw them!
|
||||
// how useless!!!
|
||||
// disable exceptions, otherwise peek() will throw them on eof!
|
||||
iss.exceptions(ios_base::goodbit);
|
||||
|
||||
// check if there is still stuff in the stream, there shouldn't
|
||||
if (iss.peek() != istringstream::traits_type::eof())
|
||||
throw domain_error(_("incorrect boolean"));
|
||||
|
||||
|
|
Loading…
Reference in New Issue