Heart 1.3.842.34c2ab5
Heart is base back end library for your c++ Qt projects.
abstracttask.cpp
Go to the documentation of this file.
1//#
2//# Copyright (C) 2021-2024 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
9
10#include "abstracttask.h"
11#include <QHash>
12#include <QByteArray>
13
14namespace QH {
15
16
18 return _mode;
19}
20
22 _mode = newMode;
23 idGen();
24}
25
26quint64 AbstractTask::time() const {
27 return _time;
28}
29
30void AbstractTask::setTime(quint64 newTime) {
31 _time = newTime;
32 idGen();
33}
34
36 return _taskId;
37}
38
40 switch (_mode) {
42 return _time > 1000 && _taskId;
43 }
44 default: return _taskId;
45 }
46}
47
48void AbstractTask::idGen() {
49 QByteArray data;
50 data.insert(0, reinterpret_cast<char*>(&_time), sizeof (_time));
51 data.insert(0, reinterpret_cast<char*>(&_mode), sizeof (_mode));
52 int code = typeid(this).hash_code();
53 data.insert(0, reinterpret_cast<char*>(&code), sizeof (code));
54
55
56 _taskId = qHash(data);
57}
58
59}
virtual bool isValid() const
isValid This method check task configuration and return true if task is valid else false.
void setMode(ScheduleMode newMode)
setMode This method sets new mode of this task.
ScheduleMode mode() const
mode This method retunr current mode of this task.
void setTime(quint64 newTime)
setTime This method sets new value for the AbstractTask::time property.
int taskId() const
taskId This method return id of this task.
quint64 time() const
time This is universal property. This property has its own meaning for each AbstractTask::mode....
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition heart.cpp:13
uint qHash(NodeCoonectionStatus status)
qHash - Simple hash function of NodeCoonectionStatus
ScheduleMode
The ScheduleMode enum contails list of the shedule modes.
@ Repeat
In this mode AbstractTask will be executed task every time from the moment of adding this task.