Go to the documentation of this file.
42 #ifndef __BASE_OUTPUT_HH__
43 #define __BASE_OUTPUT_HH__
92 template<
class StreamType>
113 const std::string &
name,
114 std::ios_base::openmode
mode,
124 const std::ios_base::openmode
_mode;
141 typedef std::map<std::string, OutputDirectory *>
dir_map_t;
187 std::string
resolve(
const std::string &
name)
const;
238 std::ios_base::openmode
mode,
239 bool recreateable =
true,
299 void remove(
const std::string &
name,
bool recursive=
false);
304 #endif // __BASE_OUTPUT_HH__
const bool _recreateable
Can the file be recreated in a new location?
~OutputDirectory()
Destructor.
Interface for creating files in a gem5 output directory.
std::ostream *const _stream
Underlying output stream.
OutputStream * find(const std::string &name) const
Finds stream associated with an open file or stdout/stderr.
OutputDirectory()
Constructor.
const std::string _name
Name in output directory.
static const char PATH_SEPARATOR
System-specific path separator character.
const std::string & name() const
Get the file name in the output directory.
OutputStream * create(const std::string &name, bool binary=false, bool no_gz=false)
Creates a file in this directory (optionally compressed).
void setDirectory(const std::string &dir)
Sets name of this directory.
OutputDirectory * createSubdirectory(const std::string &name)
Creates a subdirectory within this directory.
std::string resolve(const std::string &name) const
Returns relative file names prepended with name of this directory.
bool isFile(const std::string &name) const
Determines whether a file name corresponds to a file in this directory.
static bool isAbsolute(const std::string &name)
Test if a path is absolute.
OutputStream * findOrCreate(const std::string &name, bool binary=false)
static OutputStream stdout
std::ostream * stream() const
Get the output underlying output stream.
std::string dir
Name of this directory.
const std::ios_base::openmode _mode
File mode when opened.
file_map_t files
Open file streams within this directory.
std::map< std::string, OutputStream * > file_map_t
File names and associated stream handles.
void close(OutputStream *file)
Closes an output file and free the corresponding OutputFile.
const std::string & name()
static OutputStream * checkForStdio(const std::string &name)
Determines whether given file name corresponds to standard output streams.
static OutputStream stderr
OutputFile(const OutputDirectory &dir, const std::string &name, std::ios_base::openmode mode, bool recreateable)
stream_type_t *const _fstream
Pointer to the file stream.
virtual void relocate(const OutputDirectory &dir)
Re-create the in a new location if recreateable.
dir_map_t dirs
Output sub-directories.
virtual bool recreateable() const
Can the file be recreated if the output directory is moved?
void relocate(const OutputDirectory &dir) override
Re-create the file in a new location if it is relocatable.
OutputStream * open(const std::string &name, std::ios_base::openmode mode, bool recreateable=true, bool no_gz=false)
Open a file in this directory (optionally compressed).
void remove(const std::string &name, bool recursive=false)
Removes a specified file or subdirectory.
std::map< std::string, OutputDirectory * > dir_map_t
Output subdirectories.
const std::string & directory() const
Gets name of this directory.
bool recreateable() const override
Can the file be recreated if the output directory is moved?
OutputStream(const std::string &name, std::ostream *stream)
Wrap an existing stream.
Generated on Wed Sep 30 2020 14:02:07 for gem5 by doxygen 1.8.17