-
Notifications
You must be signed in to change notification settings - Fork 317
/
GDaemon.h
50 lines (37 loc) · 971 Bytes
/
GDaemon.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/***************************
@Author: Chunel
@Contact: chunel@foxmail.com
@File: GDaemon.h
@Time: 2022/2/3 9:54 下午
@Desc:
***************************/
#ifndef CGRAPH_GDAEMON_H
#define CGRAPH_GDAEMON_H
#include <set>
#include "GDaemonObject.h"
#include "../GraphParam/GParamInclude.h"
CGRAPH_NAMESPACE_BEGIN
class GDaemon : public GDaemonObject {
protected:
/**
* 后台执行函数,间隔interval时间后,执行一次
*/
virtual CVoid daemonTask(GDaemonParamPtr param) = 0;
/**
* 获取设置的延时信息
* @return
*/
[[nodiscard]] CMSec getInterval() const;
private:
CStatus init() final;
CStatus destroy() final;
friend class GDaemonManager;
friend class GPipeline;
private:
UTimer timer_; // 计时器
};
using GDaemonPtr = GDaemon *;
using GDaemonSet = std::set<GDaemonPtr>;
CGRAPH_NAMESPACE_END
#include "GDaemonObject.inl"
#endif //CGRAPH_GDAEMON_H