Celeritas 0.7.0-dev.555+develop.5c5a8f0a7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
celeritas::FileOrStdout Class Reference

Construct an output to a new file, or stdout if the filename is "-". More...

#include <FileOrConsole.hh>

Public Types

using Mode = std::ios::openmode
 

Public Member Functions

 FileOrStdout (std::string filename)
 Construct with filename in "append" mode.
 
 FileOrStdout (std::string filename, Mode)
 Construct with filename and custom mode.
 
 operator std::ostream & ()
 Implicitly cast to the opened stream.
 
std::string const & filename () const
 Get the filename or renamed placeholder.
 

Detailed Description

Construct an output to a new file, or stdout if the filename is "-".

Note
This appends to the file by default to be consistent across console/file, compatible with NDJSON/JSONL-style record output. Construct with the std::ios::out mode to clobber an existing file.

Constructor & Destructor Documentation

◆ FileOrStdout()

celeritas::FileOrStdout::FileOrStdout ( std::string  filename)
inlineexplicit

Construct with filename in "append" mode.

This gives consistent behavior between output files and the console.


The documentation for this class was generated from the following file: