MoorDyn
Public Member Functions | Public Attributes | List of all members
moordyn::MultiStream Class Reference

Streamer able to redirect the output to several substreams. More...

#include <Log.hpp>

Public Member Functions

 MultiStream ()
 Constructor.
 
 ~MultiStream ()
 Destructor.
 
const char * GetFile () const
 Get the output file path. More...
 
void SetFile (const char *file_path)
 Set the output file path. More...
 
void SetFile (bool enable=true)
 Enable/disable the file printing. More...
 
void SetTerminal (std::ostream &stream)
 Set the terminal streamer. More...
 
MultiStreamoperator<< (std::ostream &(*pfun)(std::ostream &))
 Functionality for std::endl alike operators.
 

Public Attributes

std::string _fpath
 The file path.
 
std::ofstream _fout
 The output file streamer.
 
bool _fout_enabled
 Flag to know if the file output is enabled.
 
std::ostream * _terminal
 The terminal active streamer.
 

Detailed Description

Streamer able to redirect the output to several substreams.

This class is actually meant as a helper for moordyn::Log

See also
Log

Member Function Documentation

◆ GetFile()

const char* moordyn::MultiStream::GetFile ( ) const
inline

Get the output file path.

Returns
The output file path, an empty string if no file has been set
Here is the caller graph for this function:

◆ SetFile() [1/2]

void moordyn::MultiStream::SetFile ( bool  enable = true)
inline

Enable/disable the file printing.

Parameters
enabletrue to enable the file printing, false to disable it

◆ SetFile() [2/2]

void moordyn::MultiStream::SetFile ( const char *  file_path)

Set the output file path.

This method will immediately try to open such file for writing.

Parameters
file_pathThe output file path
Exceptions
moordyn::output_file_errorIf the output file cannot be opened/created at file_path
Here is the caller graph for this function:

◆ SetTerminal()

void moordyn::MultiStream::SetTerminal ( std::ostream &  stream)
inline

Set the terminal streamer.

Parameters
streamThe terminal stream
Here is the caller graph for this function:

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