mFrame
載入中...
搜尋中...
無符合項目
ConsumerEvent.h
1
7#ifndef MFRAME_536D123C_E7F9_4D81_9400_5A6BE022F590
8#define MFRAME_536D123C_E7F9_4D81_9400_5A6BE022F590
9
10/* ***************************************************************************************
11 * Include
12 */
13
14//----------------------------------------------------------------------------------------
15
16//----------------------------------------------------------------------------------------
17#include "./../func/Consumer.h"
18#include "./../lang/Object.h"
19
20/* ***************************************************************************************
21 * Namespace
22 */
23namespace mframe::func {
24 class ConsumerEvent;
25} // namespace mframe::func
26
27/* ***************************************************************************************
28 * Class/Interface/Struct/Enum
29 */
31 public mframe::func::Consumer<> {
32 /* *************************************************************************************
33 * Variable
34 */
35 private:
36 void (*vFunction)(Interface&);
37 /* *************************************************************************************
38 * Abstract Method
39 */
40
41 /* *************************************************************************************
42 * Construct Method
43 */
44 public:
49 template <typename T>
50 ConsumerEvent(void (*function)(T&)) {
51 this->vFunction = reinterpret_cast<void (*)(Interface&)>(function);
52 return;
53 }
54
59 virtual ~ConsumerEvent(void) override;
60
61 /* *************************************************************************************
62 * Operator Method
63 */
64 public:
71 template <typename T>
72 inline operator const Consumer<T>&(void) const {
73 const Consumer<>* src = this;
74 return *reinterpret_cast<const Consumer<T>*>(src);
75 }
76
82 template <typename T>
83 inline operator Consumer<T>&(void) {
84 Consumer<>* src = this;
85 return *reinterpret_cast<Consumer<T>*>(src);
86 }
87
88 /* *************************************************************************************
89 * Public Method <Override> mframe::func::Consumer<void*>
90 */
91 public:
92 virtual void accept(Interface& t) override;
93
94 /* *************************************************************************************
95 * Public Method
96 */
97
98 /* *************************************************************************************
99 * Protected Method
100 */
101
102 /* *************************************************************************************
103 * Private Method
104 */
105
106 /* *************************************************************************************
107 * Static Variable
108 */
109
110 /* *************************************************************************************
111 * Static Method
112 */
113};
114
115/* ***************************************************************************************
116 * End of file
117 */
118
119#endif /* MFRAME_536D123C_E7F9_4D81_9400_5A6BE022F590 */
Definition ConsumerEvent.h:31
ConsumerEvent(void(*function)(T &))
Construct a new object.
Definition ConsumerEvent.h:50
virtual ~ConsumerEvent(void) override
Destroy the object.
Definition Object.h:34
Definition BiConsumer.h:22
Definition Consumer.h:31
Definition Interface.h:134