BioCMAMC-ST
IO::RedirectGuard Class Reference

#include <console.hpp>

Inheritance diagram for IO::RedirectGuard:
[legend]
Collaboration diagram for IO::RedirectGuard:
[legend]

Public Member Functions

 RedirectGuard ()
RedirectHandle redirect ()
RedirectHandle redirect_to_file ()
void restore ()
std::optional< std::string > getCapturedOutput () const

Private Attributes

bool has_been_redirected = false
std::streambuf * coutbuf = nullptr
std::stringstream buffer
int original_stdout_fd = -1
std::shared_ptr< bool > active_flag

Friends

class RedirectHandle

Constructor & Destructor Documentation

◆ RedirectGuard()

IO::RedirectGuard::RedirectGuard ( )

Member Function Documentation

◆ getCapturedOutput()

std::optional< std::string > IO::RedirectGuard::getCapturedOutput ( ) const

◆ redirect()

RedirectHandle IO::RedirectGuard::redirect ( )
nodiscard
Here is the call graph for this function:

◆ redirect_to_file()

RedirectHandle IO::RedirectGuard::redirect_to_file ( )
nodiscard
Here is the call graph for this function:

◆ restore()

void IO::RedirectGuard::restore ( )

◆ RedirectHandle

friend class RedirectHandle
friend

Member Data Documentation

◆ active_flag

std::shared_ptr<bool> IO::RedirectGuard::active_flag
private

◆ buffer

std::stringstream IO::RedirectGuard::buffer
private

◆ coutbuf

std::streambuf* IO::RedirectGuard::coutbuf = nullptr
private

◆ has_been_redirected

bool IO::RedirectGuard::has_been_redirected = false
private

◆ original_stdout_fd

int IO::RedirectGuard::original_stdout_fd = -1
private

The documentation for this class was generated from the following files:
  • apps/libs/common/public/common/console.hpp
  • apps/libs/common/src/logger.cpp