TreeFrogFramework 2.10
Loading...
Searching...
No Matches
tjobscheduler.h
Go to the documentation of this file.
1#pragma once
2#include <QTimer>
3#include <TDatabaseContextThread>
4#include <TGlobal>
5
6
7class T_CORE_EXPORT TJobScheduler : public TDatabaseContextThread {
8 Q_OBJECT
9public:
11 virtual ~TJobScheduler();
12
13 void start(int msec);
14 void restart();
15 void stop();
16 int interval() const;
17 bool isSingleShot() const;
18 void setSingleShot(bool singleShot);
19 bool autoDelete() const { return _autoDelete; }
20 void setAutoDelete(bool autoDelete) { _autoDelete = autoDelete; }
21
22protected:
23 virtual void job() = 0;
24 void rollbackTransaction();
25 void publish(const QString &topic, const QString &text);
26 void publish(const QString &topic, const QByteArray &binary);
27
28signals:
29 void startTimer(int msec);
30 void startTimer();
31 void stopTimer();
32
33private:
34 void run() override;
35
36 QTimer *_timer {nullptr};
37 bool _rollback {false};
38 bool _autoDelete {false};
39
42};
The TJobScheduler class provides functionality for job scheduler.
Definition tjobscheduler.h:7
void stopTimer()
void setAutoDelete(bool autoDelete)
Definition tjobscheduler.h:20
virtual void job()=0
void startTimer(int msec)
bool autoDelete() const
Definition tjobscheduler.h:19
void startTimer()
#define T_CORE_EXPORT
Definition tdeclexport.h:28
#define T_DISABLE_COPY(Class)
Definition tdeclexport.h:37
#define T_DISABLE_MOVE(Class)
Definition tdeclexport.h:41