mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-03-22 01:34:13 -05:00
40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
#pragma once
|
|
#include "sys/Task.hpp"
|
|
|
|
namespace sys
|
|
{
|
|
/// @brief Derived class of Task that has methods for tracking progress.
|
|
class ProgressTask final : public sys::Task
|
|
{
|
|
public:
|
|
/// @brief Creates a Progress task.
|
|
/// @param function
|
|
/// @param taskData
|
|
ProgressTask(sys::threadpool::JobFunction function, sys::ProgressTask::TaskData taskData);
|
|
|
|
/// @brief Resets the progress and sets a new goal.
|
|
/// @param goal The goal we all strive for.
|
|
void reset(double goal) noexcept;
|
|
|
|
/// @brief Updates the current progress.
|
|
/// @param current The current progress value.
|
|
void update_current(double current) noexcept;
|
|
|
|
/// @brief Increases the current progress by a set amount.
|
|
void increase_current(double amount) noexcept;
|
|
|
|
/// @brief Returns the goal value.
|
|
/// @return Goal
|
|
double get_goal() const noexcept;
|
|
|
|
/// @brief Returns the current progress.
|
|
/// @return Current progress.
|
|
double get_progress() const noexcept;
|
|
|
|
private:
|
|
// Current value and goal
|
|
double m_current{};
|
|
double m_goal{};
|
|
};
|
|
} // namespace sys
|