Hello all,

I have a question about the _stream variable of the OutputStream 
class(base/output.hh, base/output.cc)

I had a question about the variable definition.
std::ostream *const _stream;

Why do we use std::ostream vs std::ofstream? 

The reason I am asking is because I cannot seem to find close method for 
std::ostream while for std::ofstream there is a close method.

Let us look at the following example of a stream in BaseCPU

In src/cpu/base.cc
 functionTraceStream = simout.findOrCreate(fname)->stream();

In src/cpu/base.hh
std::ostream *functionTraceStream;

I cannot find any code in src/cpu/base.cc which closes the stream. Is there a 
reason for this? 

I would have expected to see a call to something like this somewhere in 
src/cpu/base.cc:
 void OutputDirectory::close(OutputStream *file)


Right now I am using this close method for the streams I am creating. In this 
case, I need to make sure I capture the OutputStream pointer in order to use 
the OutputDirectory::close method. Thus I do something like:

OutputStream *testStreamContainer = simout.findOrCreate(fname);
std::ostream *testStream = testStreamContainer->stream();
....
simout.close(testStreamContainer);

I assume this should close the stream correctly? Does anyone have any comments 
or have they done something similar?

Thanks,

Scott Blankenberg
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to