eive-obsw/mission/utility/ProgressPrinter.cpp
2022-04-16 17:19:32 +02:00

17 lines
619 B
C++

#include "ProgressPrinter.h"
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
ProgressPrinter::ProgressPrinter(std::string name, uint32_t numSteps, uint32_t percentageResolution)
: name(name), numSteps(numSteps) {}
ProgressPrinter::~ProgressPrinter() {}
void ProgressPrinter::print(uint32_t currentStep) {
float progressInPercent = static_cast<float>(currentStep) / static_cast<float>(numSteps) * 100;
if (static_cast<uint32_t>(progressInPercent) >= nextProgressPrint) {
sif::info << name << " progress: " << progressInPercent << " %" << std::endl;
nextProgressPrint += FIVE_PERCENT;
}
}