gtopt::FcutLogWriter class

Mutex-serialised writer for the gtopt_fcut.log debug file.

Owned by SDDPMethod (stable lifetime across the scene-parallel forward passes). configure() is called once at solve() start — before any pool task runs — after which enabled() is a const read. The file is opened lazily on the first write() (append mode, so cascade levels and hot-start reruns extend the same file with their own session records instead of truncating earlier evidence).

Public static variables

static std::string_view filename

Constructors, destructors, conversion operators

FcutLogWriter() defaulted
FcutLogWriter(const FcutLogWriter&) deleted
FcutLogWriter(FcutLogWriter&&) deleted
~FcutLogWriter() defaulted

Public functions

void configure(bool enabled, std::string log_directory)
auto enabled() const -> bool noexcept
auto operator=(const FcutLogWriter&) -> FcutLogWriter& deleted
auto operator=(FcutLogWriter&&) -> FcutLogWriter& deleted
void write(std::string_view record)

Function documentation

void gtopt::FcutLogWriter::configure(bool enabled, std::string log_directory)

Arm (or disarm) the writer. Must be called before the parallel passes start; an empty log_directory disables the writer even when enabled is true. Re-configuring closes any open file so the next write reopens under the new directory.

bool gtopt::FcutLogWriter::enabled() const noexcept

True when records will be written. Call sites use this to skip record assembly entirely on the (default) disabled path.

void gtopt::FcutLogWriter::write(std::string_view record)

Append one record (multi-line allowed) atomically and flush. A trailing newline is added when record lacks one. No-op when disabled; disables itself with a WARN when the file cannot be opened.

Variable documentation

static std::string_view gtopt::FcutLogWriter::filename

File name inside the resolved log directory — sibling of the gtopt_<N>.log file the standalone binary writes there.