UFJF - Machine Learning Toolkit  0.51.8
mltk::synced_stream Class Reference

A helper class to synchronize printing to an output stream by different threads. More...

#include <ThreadPool.hpp>

Public Member Functions

 synced_stream (std::ostream &_out_stream=std::cout)
 Construct a new synced stream. More...
 
template<typename... T>
void print (const T &...items)
 Print any number of items into the output stream. Ensures that no other threads print to this stream simultaneously, as long as they all exclusively use this synced_stream object to print. More...
 
template<typename... T>
void println (const T &...items)
 Print any number of items into the output stream, followed by a newline character. Ensures that no other threads print to this stream simultaneously, as long as they all exclusively use this synced_stream object to print. More...
 

Detailed Description

A helper class to synchronize printing to an output stream by different threads.

Constructor & Destructor Documentation

◆ synced_stream()

mltk::synced_stream::synced_stream ( std::ostream &  _out_stream = std::cout)
inline

Construct a new synced stream.

Parameters
_out_streamThe output stream to print to. The default value is std::cout.

Member Function Documentation

◆ print()

template<typename... T>
void mltk::synced_stream::print ( const T &...  items)
inline

Print any number of items into the output stream. Ensures that no other threads print to this stream simultaneously, as long as they all exclusively use this synced_stream object to print.

Template Parameters
TThe types of the items
Parameters
itemsThe items to print.

◆ println()

template<typename... T>
void mltk::synced_stream::println ( const T &...  items)
inline

Print any number of items into the output stream, followed by a newline character. Ensures that no other threads print to this stream simultaneously, as long as they all exclusively use this synced_stream object to print.

Template Parameters
TThe types of the items
Parameters
itemsThe items to print.

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