forked from ChunelFeng/CGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGDaemonManager.cpp
More file actions
89 lines (64 loc) · 1.58 KB
/
GDaemonManager.cpp
File metadata and controls
89 lines (64 loc) · 1.58 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/***************************
@Author: Chunel
@Contact: chunel@foxmail.com
@File: GDaemonManager.cpp
@Time: 2022/2/3 10:26 上午
@Desc:
***************************/
#include "GDaemonManager.h"
CGRAPH_NAMESPACE_BEGIN
GDaemonManager::~GDaemonManager() {
clear();
}
CStatus GDaemonManager::init() {
CGRAPH_FUNCTION_BEGIN
for (auto daemon: daemons_) {
CGRAPH_ASSERT_NOT_NULL(daemon)
status += daemon->init();
}
CGRAPH_FUNCTION_END
}
CStatus GDaemonManager::destroy() {
CGRAPH_FUNCTION_BEGIN
for (auto daemon: daemons_) {
CGRAPH_ASSERT_NOT_NULL(daemon)
status += daemon->destroy();
}
CGRAPH_FUNCTION_END
}
CStatus GDaemonManager::add(GDaemonPtr daemon) {
CGRAPH_FUNCTION_BEGIN
CGRAPH_ASSERT_NOT_NULL(daemon)
daemons_.insert(daemon);
CGRAPH_FUNCTION_END
}
CStatus GDaemonManager::remove(GDaemonPtr daemon) {
CGRAPH_FUNCTION_BEGIN
CGRAPH_ASSERT_NOT_NULL(daemon)
daemons_.erase(daemon);
CGRAPH_DELETE_PTR(daemon)
CGRAPH_FUNCTION_END
}
CStatus GDaemonManager::clear() {
CGRAPH_FUNCTION_BEGIN
for (auto daemon: daemons_) {
CGRAPH_DELETE_PTR(daemon)
}
daemons_.clear();
CGRAPH_FUNCTION_END
}
CSize GDaemonManager::getSize() const {
CSize size = daemons_.size();
return size;
}
GDaemonManagerPtr GDaemonManager::setInterval(CMSec interval) {
if (0 == interval) {
return this;
}
for (auto daemon : daemons_) {
CGRAPH_ASSERT_NOT_NULL_THROW_ERROR(daemon)
daemon->setInterval(interval);
}
return this;
}
CGRAPH_NAMESPACE_END