#pragma once #include "system/Task.hpp" namespace sys { /// @brief Derived class of Task that has methods for tracking progress. class ProgressTask : public sys::Task { public: /// @brief Contstructs a new ProgressTask /// @param function Function for thread to execute. /// @param args Arguments to forward to the thread function. /// @note All functions passed to this must follow this signature: void function(sys::ProgressTask *, ) template ProgressTask(void (*function)(sys::ProgressTask *, Args...), Args... args) : sys::Task(function, this, std::forward(args)...){}; /// @brief Resets the progress and sets a new goal. /// @param goal The goal we all strive for. void reset(double goal); /// @brief Updates the current progress. /// @param current The current progress value. void update_current(double current); /// @brief Returns the goal value. /// @return Goal double get_goal() const; /// @brief Returns the current progress. /// @return Current progress. double get_current() const; private: // Current value and goal double m_current, m_goal; }; } // namespace sys