Heart
1.4.918.d927d9c
Heart is base back end library for your c++ Qt projects.
Toggle main menu visibility
Loading...
Searching...
No Matches
taskscheduler.h
Go to the documentation of this file.
1
//#
2
//# Copyright (C) 2021-2025 QuasarApp.
3
//# Distributed under the lgplv3 software license, see the accompanying
4
//# Everyone is permitted to copy and distribute verbatim copies
5
//# of this license document, but changing it is not allowed.
6
//#
7
8
#ifndef TASKSCHEDULER_H
9
#define TASKSCHEDULER_H
10
11
#include "
abstracttask.h
"
12
13
#include <QHash>
14
#include <QMap>
15
#include <QSharedPointer>
16
#include <QTimer>
17
18
namespace
QH
{
19
24
class
TaskScheduler
:
public
QObject
25
{
26
Q_OBJECT
27
public
:
28
TaskScheduler
();
29
~TaskScheduler
();
30
36
bool
shedule
(
const
QSharedPointer<AbstractTask>& task);
37
43
bool
remove
(
const
QSharedPointer<AbstractTask>& task);
44
50
bool
remove
(
int
task);
51
56
int
taskCount
()
const
;
57
58
signals:
63
void
sigPushWork
(QSharedPointer<QH::AbstractTask> work);
64
65
private
slots:
66
void
handleTimeOut();
67
68
private
:
69
int
getTimeout(qint64 timeout);
70
71
72
QMultiMap<quint64, int> _taskQueue;
73
QHash<int, QSharedPointer<AbstractTask>> _taskPool;
74
QTimer *_timer =
nullptr
;
75
};
76
}
77
#endif
// TASKSCHEDULER_H
abstracttask.h
QH::TaskScheduler::sigPushWork
void sigPushWork(QSharedPointer< QH::AbstractTask > work)
sigPushWork This signal emited when the task work neet to execute.
QH::TaskScheduler::shedule
bool shedule(const QSharedPointer< AbstractTask > &task)
shedule This method shedule new task in this node.
Definition
taskscheduler.cpp:30
QH::TaskScheduler::TaskScheduler
TaskScheduler()
Definition
taskscheduler.cpp:14
QH::TaskScheduler::taskCount
int taskCount() const
taskCount This method return tasks count.
Definition
taskscheduler.cpp:80
QH::TaskScheduler::remove
bool remove(const QSharedPointer< AbstractTask > &task)
remove This method remove the task from a tasks queue.
Definition
taskscheduler.cpp:67
QH
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition
heart.cpp:13
src
private
taskscheduler.h
Generated by
1.18.0