Heart
1.4.918.d927d9c
Heart is base back end library for your c++ Qt projects.
Toggle main menu visibility
Loading...
Searching...
No Matches
abstracttask.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 ABSTRACTTASK_H
9
#define ABSTRACTTASK_H
10
11
#include <QSharedPointer>
12
#include "heart_global.h"
13
14
namespace
QH
{
15
16
class
AbstractNode
;
20
enum class
ScheduleMode
:
int
{
22
SingleWork
,
24
Repeat
,
26
TimePoint
27
};
28
29
33
class
HEARTSHARED_EXPORT
AbstractTask
34
{
35
public
:
36
40
enum
TimeValMsec
: qint64 {
42
Msec
= 1,
44
Sec
= 1000 *
Msec
,
46
Min
= 60 *
Sec
,
48
Hour
= 60 *
Min
,
50
Day
= 24 *
Hour
51
};
52
53
AbstractTask
() =
default
;
54
virtual
~AbstractTask
() =
default
;
55
61
ScheduleMode
mode
()
const
;
62
68
void
setMode
(
ScheduleMode
newMode);
69
77
quint64
time
()
const
;
78
84
void
setTime
(quint64 newTime);
85
91
virtual
bool
execute
(
AbstractNode
*node)
const
= 0;
92
97
int
taskId
()
const
;
98
103
virtual
bool
isValid
()
const
;
104
105
private
:
106
void
idGen();
107
ScheduleMode
_mode =
ScheduleMode::SingleWork
;
108
quint64 _time = 0;
109
int
_taskId = 0;
110
};
111
112
}
113
114
Q_DECLARE_METATYPE
(QSharedPointer<QH::AbstractTask>)
115
116
117
#endif
// ABSTRACTTASK_H
QH::AbstractNode
The AbstractNode class - Abstract implementation of node. this implementation have a methods for send...
Definition
abstractnode.h:101
QH::AbstractTask::isValid
virtual bool isValid() const
isValid This method check task configuration and return true if task is valid else false.
Definition
abstracttask.cpp:39
QH::AbstractTask::setMode
void setMode(ScheduleMode newMode)
setMode This method sets new mode of this task.
Definition
abstracttask.cpp:21
QH::AbstractTask::execute
virtual bool execute(AbstractNode *node) const =0
execute This method will be invoked when task be executed.
QH::AbstractTask::mode
ScheduleMode mode() const
mode This method retunr current mode of this task.
Definition
abstracttask.cpp:17
QH::AbstractTask::setTime
void setTime(quint64 newTime)
setTime This method sets new value for the AbstractTask::time property.
Definition
abstracttask.cpp:30
QH::AbstractTask::AbstractTask
AbstractTask()=default
QH::AbstractTask::taskId
int taskId() const
taskId This method return id of this task.
Definition
abstracttask.cpp:35
QH::AbstractTask::time
quint64 time() const
time This is universal property. This property has its own meaning for each AbstractTask::mode....
Definition
abstracttask.cpp:26
QH::AbstractTask::~AbstractTask
virtual ~AbstractTask()=default
QH::AbstractTask::TimeValMsec
TimeValMsec
The TimeVal enum contains all time values for a tasks scheduling.
Definition
abstracttask.h:40
QH::AbstractTask::Min
@ Min
Minutes.
Definition
abstracttask.h:46
QH::AbstractTask::Msec
@ Msec
Milessecundes.
Definition
abstracttask.h:42
QH::AbstractTask::Day
@ Day
Days.
Definition
abstracttask.h:50
QH::AbstractTask::Hour
@ Hour
Hours.
Definition
abstracttask.h:48
QH::AbstractTask::Sec
@ Sec
Secundes.
Definition
abstracttask.h:44
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QH::HostAddress)
QH
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition
heart.cpp:13
QH::ScheduleMode
ScheduleMode
The ScheduleMode enum contails list of the shedule modes.
Definition
abstracttask.h:20
QH::ScheduleMode::TimePoint
@ TimePoint
In this mode AbstractTask will be executed int time msecunds by Unix time.
Definition
abstracttask.h:26
QH::ScheduleMode::Repeat
@ Repeat
In this mode AbstractTask will be executed task every time from the moment of adding this task.
Definition
abstracttask.h:24
QH::ScheduleMode::SingleWork
@ SingleWork
In this mode AbstractTask will be executed after time msecunds from the moment of adding this task.
Definition
abstracttask.h:22
src
public
abstracttask.h
Generated by
1.18.0