forked from ChunelFeng/CGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGEventManagerWrapper.h
More file actions
54 lines (46 loc) · 2.63 KB
/
GEventManagerWrapper.h
File metadata and controls
54 lines (46 loc) · 2.63 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
/***************************
@Author: Chunel
@Contact: chunel@foxmail.com
@File: GEventManagerWrapper.h
@Time: 2023/5/17 22:02
@Desc:
***************************/
#ifndef CGRAPH_GEVENTMANAGERWRAPPER_H
#define CGRAPH_GEVENTMANAGERWRAPPER_H
#include "GEvent.h"
#include "GEventManager.h"
CGRAPH_NAMESPACE_BEGIN
#define CGRAPH_DECLARE_GEVENT_MANAGER_WRAPPER \
/**
* 设置统一管控信号类
* @param em
* @return
*/ \
virtual void* setGEventManager(GEventManagerPtr em) { \
this->event_manager_ = em; \
return this; \
} \
\
/**
* 触发一个事件
* @param key
* @param type
* @return
* @notice 返回值仅表示是否触发成功,不表示事件是否执行成功
*/ \
CStatus notify(const std::string& key, GEventType type, \
GEventAsyncStrategy strategy = GEventAsyncStrategy::PIPELINE_RUN_FINISH) { \
CGRAPH_FUNCTION_BEGIN \
CGRAPH_ASSERT_NOT_NULL(this->event_manager_) \
status = this->event_manager_->trigger(key, type, strategy); \
CGRAPH_FUNCTION_END \
} \
\
#define CGRAPH_DECLARE_GEVENT_MANAGER_WRAPPER_WITH_MEMBER \
private: \
GEventManagerPtr event_manager_ = nullptr; \
protected: \
CGRAPH_DECLARE_GEVENT_MANAGER_WRAPPER \
\
CGRAPH_NAMESPACE_END
#endif //CGRAPH_GEVENTMANAGERWRAPPER_H