diff options
author | Clint Smullen <cws3k@cs.virginia.edu> | 2008-11-15 23:42:11 -0500 |
---|---|---|
committer | Clint Smullen <cws3k@cs.virginia.edu> | 2008-11-15 23:42:11 -0500 |
commit | 3087be945d84031d7d6a9cd45bd90d5767d1b7cc (patch) | |
tree | d31827399f743c8ab629e4e49125d9522b90282c /src/base/output.hh | |
parent | 4514f565e3dfe1de41bbaec05f3f0074e5299bac (diff) | |
download | gem5-3087be945d84031d7d6a9cd45bd90d5767d1b7cc.tar.xz |
Output: Include gzstream package to allow automatically-gzipped output
The gzstream package provides an ostream-interface for writing gzipped files.
The package comes from:
http://www.cs.unc.edu/Research/compgeom/gzstream/
And is distributed under the LGPL license. Both the license and version
information has been preservered, though all other files in the package have
been purged. Minor modifications to the code have been made. The output module
detects when a filename ends in .gz and constructs an ogzstream object instead
of an ofstream object. This works for both the create(...) and find(...)
commands. Additionally, since gzstream objects needs to be closed to ensure
proper file termination, I have the output deconstructor deleting all ostream's
that it manages on behalf of find(...). At the moment, the only output file
that I know this functionality works for is stats, i.e. by specifying
"--stats-file=m5stats.txt.gz" on the command line.
Diffstat (limited to 'src/base/output.hh')
-rw-r--r-- | src/base/output.hh | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/base/output.hh b/src/base/output.hh index b1d1d7e7d..38c63714c 100644 --- a/src/base/output.hh +++ b/src/base/output.hh @@ -31,7 +31,7 @@ #ifndef __BASE_OUTPUT_HH__ #define __BASE_OUTPUT_HH__ -#include <iosfwd> +#include <ios> #include <map> #include <string> @@ -43,14 +43,19 @@ class OutputDirectory map_t files; std::string dir; - std::string resolve(const std::string &name); + std::string resolve(const std::string &name) const; + + protected: + std::ostream *checkForStdio(const std::string &name) const; + std::ostream *openFile(const std::string &filename, + std::ios_base::openmode mode = std::ios::trunc) const; public: OutputDirectory(); ~OutputDirectory(); void setDirectory(const std::string &dir); - const std::string &directory(); + const std::string &directory() const; std::ostream *create(const std::string &name, bool binary = false); std::ostream *find(const std::string &name); |