weathermonitor-experiment adapted to ProtoStream

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1299 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
hellwig
2012-06-05 12:48:53 +00:00
parent 362ed5bb18
commit 03c1ce8a0f
2 changed files with 13 additions and 20 deletions

View File

@ -68,8 +68,8 @@ bool WeathermonitorExperiment::run()
//tp.setLogIPOnly(true);
// record trace
Trace trace;
tp.setTraceMessage(&trace);
std::ofstream of("trace.pb");
tp.setTraceFile(&of);
// this must be done *after* configuring the plugin:
sal::simulator.addFlow(&tp);
@ -94,14 +94,11 @@ bool WeathermonitorExperiment::run()
sal::simulator.removeFlow(&tp);
// serialize trace to file
char const *tracefile = "trace.pb";
std::ofstream of(tracefile);
if (of.fail()) {
log << "failed to write " << tracefile << endl;
sal::simulator.clearEvents(this); // cleanup
return false;
}
trace.SerializeToOstream(&of);
of.close();
log << "trace written to " << tracefile << endl;