Remove unused TaskManager class
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @namespace yaze::app::core
|
* @namespace yaze::app::core
|
||||||
* @brief Core application logic and utilities.
|
* @brief Core application logic and utilities.
|
||||||
@@ -153,81 +154,6 @@ class NotifyValue {
|
|||||||
T temp_value_;
|
T temp_value_;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TaskCheckpoint {
|
|
||||||
int task_index = 0;
|
|
||||||
bool complete = false;
|
|
||||||
// You can add more internal data or state-related variables here as needed
|
|
||||||
};
|
|
||||||
|
|
||||||
class TaskTimer {
|
|
||||||
public:
|
|
||||||
// Starts the timer
|
|
||||||
void StartTimer() { start_time_ = std::chrono::steady_clock::now(); }
|
|
||||||
|
|
||||||
// Checks if the task should finish based on the given timeout in seconds
|
|
||||||
bool ShouldFinishTask(int timeout_seconds) {
|
|
||||||
auto current_time = std::chrono::steady_clock::now();
|
|
||||||
auto elapsed_time = std::chrono::duration_cast<std::chrono::seconds>(
|
|
||||||
current_time - start_time_);
|
|
||||||
return elapsed_time.count() >= timeout_seconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::chrono::steady_clock::time_point start_time_;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename TFunc>
|
|
||||||
class TaskManager {
|
|
||||||
public:
|
|
||||||
TaskManager() = default;
|
|
||||||
~TaskManager() = default;
|
|
||||||
|
|
||||||
TaskManager(int totalTasks, int timeoutSeconds)
|
|
||||||
: total_tasks_(totalTasks),
|
|
||||||
timeout_seconds_(timeoutSeconds),
|
|
||||||
task_index_(0),
|
|
||||||
task_complete_(false) {}
|
|
||||||
|
|
||||||
void ExecuteTasks(const TFunc &taskFunc) {
|
|
||||||
if (task_complete_) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
StartTimer();
|
|
||||||
|
|
||||||
for (; task_index_ < total_tasks_; ++task_index_) {
|
|
||||||
taskFunc(task_index_);
|
|
||||||
|
|
||||||
if (ShouldFinishTask()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (task_index_ == total_tasks_) {
|
|
||||||
task_complete_ = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsTaskComplete() const { return task_complete_; }
|
|
||||||
void SetTimeout(int timeout) { timeout_seconds_ = timeout; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
int total_tasks_;
|
|
||||||
int timeout_seconds_;
|
|
||||||
int task_index_;
|
|
||||||
bool task_complete_;
|
|
||||||
std::chrono::steady_clock::time_point start_time_;
|
|
||||||
|
|
||||||
void StartTimer() { start_time_ = std::chrono::steady_clock::now(); }
|
|
||||||
|
|
||||||
bool ShouldFinishTask() {
|
|
||||||
auto current_time = std::chrono::steady_clock::now();
|
|
||||||
auto elapsed_time = std::chrono::duration_cast<std::chrono::seconds>(
|
|
||||||
current_time - start_time_);
|
|
||||||
return elapsed_time.count() >= timeout_seconds_;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class ImGuiIdIssuer {
|
class ImGuiIdIssuer {
|
||||||
private:
|
private:
|
||||||
static std::stack<ImGuiID> idStack;
|
static std::stack<ImGuiID> idStack;
|
||||||
|
|||||||
Reference in New Issue
Block a user