nnlib
GPU-accelerated, C/C++ neural network library.
Functions
printing.cpp File Reference

Source file defining methods to construct useful string messages. More...

#include "printing.h"
#include <iostream>
#include <utility>

Functions

std::string constructFinishedProgressBar ()
 Construct a finished progress bar. More...
 
std::string constructProgressBar (size_t currentStep, size_t maxSteps)
 Construct a string message representing a progress bar. More...
 
std::string constructPercentage (size_t currentStep, size_t maxSteps)
 Construct a string message about progress in percentage form. More...
 
std::string constructTime (size_t milliseconds)
 Construct a string message displaying current time spent. More...
 

Detailed Description

Source file defining methods to construct useful string messages.

Author
Jan Warchocki
Date
05 April 2022

Function Documentation

◆ constructFinishedProgressBar()

std::string constructFinishedProgressBar ( )

Construct a finished progress bar.

Returns
A string representing a finished progress bar.

◆ constructPercentage()

std::string constructPercentage ( size_t  currentStep,
size_t  maxSteps 
)

Construct a string message about progress in percentage form.

The info is displayed in the following format:

[25/50 (50%)]
Parameters
currentStepThe current progress to display.
maxStepsThe maximum progress that can be achieved.
Returns
A string representing the percentage.

◆ constructProgressBar()

std::string constructProgressBar ( size_t  currentStep,
size_t  maxSteps 
)

Construct a string message representing a progress bar.

The progress bar is displayed in the following format:

[==============>-----]
Parameters
currentStepThe current progress to display.
maxStepsThe maximum progress that can be achieved.
Returns
A string representing the progress bar.

◆ constructTime()

std::string constructTime ( size_t  milliseconds)

Construct a string message displaying current time spent.

The time is displayed in the following format:

(0h 2m 5s 127ms)
Parameters
millisecondsThe amount of time to display in milliseconds.
Returns
A string representing the time.