MAGE  v0.171.0
Matthias Advanced Game Engine
mage::ProgressReporter::Impl Class Reference

Public Member Functions

 Impl (std::string_view title, U32 nb_work, char progress_char='+', FU16 bar_length=0u)
 
 Impl (const Impl &reporter)=delete
 
 Impl (Impl &&reporter) noexcept
 
 ~Impl ()
 
Imploperator= (const Impl &reporter)=delete
 
Imploperator= (Impl &&reporter)=delete
 
void Update (U32 nb_work=1u)
 
void Done ()
 

Private Member Functions

void Initialize (std::string_view title, FU16 bar_length=0u)
 

Private Attributes

U32 m_nb_work_total
 
U32 m_nb_work_done
 
FU16 m_nb_progress_total
 
FU16 m_nb_progress_printed
 
char m_progress_char
 
NotNull< std::FILE *> m_fout
 
DynamicArray< char > m_buffer
 
char * m_current_pos
 
WallClockTimer m_timer
 
std::mutex m_mutex
 

Detailed Description

A class of progress reporters.

Constructor & Destructor Documentation

◆ Impl() [1/3]

mage::ProgressReporter::Impl::Impl ( std::string_view  title,
U32  nb_work,
char  progress_char = '+',
FU16  bar_length = 0u 
)
explicit

Constructs a progress reporter.

Parameters
[in]titleThe title.
[in]nb_workThe total number of work units.
[in]progress_charThe character representing the progress.
[in]bar_lengthThe length of the progress bar. If bar_length is equal to 0 the default length will be chosen.

◆ Impl() [2/3]

mage::ProgressReporter::Impl::Impl ( const Impl reporter)
delete

Constructs a progress reporter from the given progress reporter.

Parameters
[in]reporterA reference to the progress reporter to copy.

◆ Impl() [3/3]

mage::ProgressReporter::Impl::Impl ( Impl &&  reporter)
noexcept

Constructs a progress reporter by moving the given progress reporter.

Parameters
[in]reporterA reference to the progress reporter to move.

◆ ~Impl()

mage::ProgressReporter::Impl::~Impl ( )
default

Destructs this progress reporter.

Member Function Documentation

◆ Done()

void mage::ProgressReporter::Impl::Done ( )

Finishes this progress reporter.

◆ Initialize()

void mage::ProgressReporter::Impl::Initialize ( std::string_view  title,
FU16  bar_length = 0u 
)
private

Initializes this progress reporter.

Parameters
[in]titleThe title.
[in]bar_lengthThe length of the progress bar. If bar_length is equal to 0 the default length will be chosen.

◆ operator=() [1/2]

Impl& mage::ProgressReporter::Impl::operator= ( const Impl reporter)
delete

Copies the given progress reporter to this progress reporter.

Parameters
[in]reporterA reference to the progress reporter to copy.
Returns
A reference to the copy of the given progress reporter (i.e. this progress reporter).

◆ operator=() [2/2]

Impl& mage::ProgressReporter::Impl::operator= ( Impl &&  reporter)
delete

Copies the given progress reporter to this progress reporter.

Parameters
[in]reporterA reference to the progress reporter to move.
Returns
A reference to moved progress reporter (i.e. this progress reporter).

◆ Update()

void mage::ProgressReporter::Impl::Update ( U32  nb_work = 1u)

Updates this progress reporter.

Parameters
[in]nb_workThe number of work units that are done.

Member Data Documentation

◆ m_buffer

DynamicArray< char > mage::ProgressReporter::Impl::m_buffer
private

A pointer to the output buffer of this progress reporter.

◆ m_current_pos

char* mage::ProgressReporter::Impl::m_current_pos
private

A pointer to the current character in the output buffer of this progress reporter.

◆ m_fout

NotNull< std::FILE* > mage::ProgressReporter::Impl::m_fout
private

A pointer to the output file stream of this progress reporter.

◆ m_mutex

std::mutex mage::ProgressReporter::Impl::m_mutex
private

The mutex of this progress reporter.

◆ m_nb_progress_printed

FU16 mage::ProgressReporter::Impl::m_nb_progress_printed
private

The total number of progress characters that are currently outputted by this progress reporter.

◆ m_nb_progress_total

FU16 mage::ProgressReporter::Impl::m_nb_progress_total
private

The total number of progress characters that need to be outputted by this progress reporter.

◆ m_nb_work_done

U32 mage::ProgressReporter::Impl::m_nb_work_done
private

The number of work units that are currently done.

◆ m_nb_work_total

U32 mage::ProgressReporter::Impl::m_nb_work_total
private

The total number of work units that need to be done.

◆ m_progress_char

char mage::ProgressReporter::Impl::m_progress_char
private

The progress character of this progress reporter.

◆ m_timer

WallClockTimer mage::ProgressReporter::Impl::m_timer
private

The timer of this progress reporter.