Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
bitpit::LoggerBuffer Class Reference

Stream buffer for the message logger. More...

Inheritance diagram for bitpit::LoggerBuffer:
Inheritance graph
[legend]
Collaboration diagram for bitpit::LoggerBuffer:
Collaboration graph
[legend]

Classes

struct  Settings
 

Public Member Functions

 LoggerBuffer (const LoggerBuffer &other)=delete
 
 LoggerBuffer (int nProcesses, int rank, std::size_t bufferSize=256)
 
 LoggerBuffer (LoggerBuffer &&other)=delete
 
 ~LoggerBuffer ()
 
int flush (bool terminate)
 
std::ostream & getConsoleStream ()
 
std::ofstream & getFileStream ()
 
int getProcessCount () const
 
int getRank () const
 
const SettingsgetSettings () const
 
void setConsoleEnabled (bool enabled)
 
void setConsoleStream (std::ostream *console)
 
void setFileEnabled (bool enabled)
 
void setFileStream (std::ofstream *file)
 
void setSettings (const std::shared_ptr< Settings > &settings)
 

Detailed Description

Stream buffer for the message logger.

This class implements a stream buffer used by the message logger.

Definition at line 83 of file logger.hpp.

Constructor & Destructor Documentation

◆ LoggerBuffer()

bitpit::LoggerBuffer::LoggerBuffer ( int nProcesses,
int rank,
std::size_t bufferSize = 256 )

Creates a new buffer.

Parameters
nProcessesis the total number of processes in the communicator
rankis the parallel rank in the communicator
bufferSizeis the size of the internal buffer

Definition at line 63 of file logger.cpp.

◆ ~LoggerBuffer()

bitpit::LoggerBuffer::~LoggerBuffer ( )

Destructor

Definition at line 100 of file logger.cpp.

Member Function Documentation

◆ flush()

int bitpit::LoggerBuffer::flush ( bool terminate)

Flushes stream buffer.

Parameters
terminateif true ensures that a new line is added as last character
Returns
Returns 0 to indicates success, -1 to indicate failure.

Definition at line 173 of file logger.cpp.

◆ getConsoleStream()

std::ostream & bitpit::LoggerBuffer::getConsoleStream ( )

Gets the stream to be used for the output on the console.

Returns
The stream to be used for the output on the console.

Definition at line 333 of file logger.cpp.

◆ getFileStream()

std::ofstream & bitpit::LoggerBuffer::getFileStream ( )

Gets the stream to be used for the output on the file.

Returns
The stream to be used for the output on the file.

Definition at line 375 of file logger.cpp.

◆ getProcessCount()

int bitpit::LoggerBuffer::getProcessCount ( ) const

Count the number of processes in the communicator.

Returns
The number of processes in the communicator.

Definition at line 110 of file logger.cpp.

◆ getRank()

int bitpit::LoggerBuffer::getRank ( ) const

Gets the rank in the communicator.

Returns
The rank in the communicator.

Definition at line 120 of file logger.cpp.

◆ getSettings()

const LoggerBuffer::Settings * bitpit::LoggerBuffer::getSettings ( ) const

Get a constant pointer to the buffer settings.

Returns
A constant pointer to the buffer settings.

Definition at line 385 of file logger.cpp.

◆ setConsoleEnabled()

void bitpit::LoggerBuffer::setConsoleEnabled ( bool enabled)

Enables the output on the console.

Parameters
enabledif set to true enables the console output.

Definition at line 305 of file logger.cpp.

◆ setConsoleStream()

void bitpit::LoggerBuffer::setConsoleStream ( std::ostream * console)

Sets the stream to be used for the output on the console.

Parameters
consoleis the stream to be used for the output on the console

Definition at line 321 of file logger.cpp.

◆ setFileEnabled()

void bitpit::LoggerBuffer::setFileEnabled ( bool enabled)

Enables the output on the log file.

The output on the log file can be enabled only id the log file path has been set. If there is no log file path specified, the output on the file will not be enabled.

Parameters
enabledif set to true enables the output on the log file

Definition at line 347 of file logger.cpp.

◆ setFileStream()

void bitpit::LoggerBuffer::setFileStream ( std::ofstream * file)

Sets the stream to be used for the output on the file.

Parameters
fileis the stream to be used for the output on the file

Definition at line 363 of file logger.cpp.

◆ setSettings()

void bitpit::LoggerBuffer::setSettings ( const std::shared_ptr< Settings > & settings)

Sets buffer settings.

Parameters
settingsare the buffer settings

Definition at line 395 of file logger.cpp.


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