47 #ifndef __BASE_OUTPUT_HH__ 48 #define __BASE_OUTPUT_HH__ 97 template<
class StreamType>
118 const std::string &
name,
119 std::ios_base::openmode
mode,
129 const std::ios_base::openmode
_mode;
146 typedef std::map<std::string, OutputDirectory *>
dir_map_t;
158 static const char PATH_SEPARATOR =
'/';
192 std::string resolve(
const std::string &
name)
const;
198 void setDirectory(
const std::string &dir);
204 const std::string &directory()
const;
243 std::ios_base::openmode
mode,
274 bool isFile(
const std::string &
name)
const;
280 return name[0] == PATH_SEPARATOR;
304 void remove(
const std::string &
name,
bool recursive=
false);
309 #endif // __BASE_OUTPUT_HH__ bool recreateable() const override
Can the file be recreated if the output directory is moved?
virtual void relocate(const OutputDirectory &dir)
Re-create the in a new location if recreateable.
std::map< std::string, OutputDirectory * > dir_map_t
Output subdirectories.
std::ostream *const _stream
Underlying output stream.
const std::string & name() const
Get the file name in the output directory.
const bool _recreateable
Can the file be recreated in a new location?
std::ostream * stream() const
Get the output underlying output stream.
file_map_t files
Open file streams within this directory.
const std::string _name
Name in output directory.
virtual bool recreateable() const
Can the file be recreated if the output directory is moved?
const std::ios_base::openmode _mode
File mode when opened.
friend class OutputDirectory
static OutputStream stdout
static OutputStream stderr
OutputStream(const std::string &name, std::ostream *stream)
Wrap an existing stream.
static bool isAbsolute(const std::string &name)
Test if a path is absolute.
std::string dir
Name of this directory.
dir_map_t dirs
Output sub-directories.
std::map< std::string, OutputStream * > file_map_t
File names and associated stream handles.
Interface for creating files in a gem5 output directory.
stream_type_t *const _fstream
Pointer to the file stream.