mFrame
載入中...
搜尋中...
無符合項目
SupplierEvent.h
1
7#ifndef MFRAME_7F766F57_BAD7_450F_A3E1_A0A364C87CDE
8#define MFRAME_7F766F57_BAD7_450F_A3E1_A0A364C87CDE
9
10/* ***************************************************************************************
11 * Include
12 */
13
14//----------------------------------------------------------------------------------------
15
16//----------------------------------------------------------------------------------------
17#include "./../func/Supplier.h"
18#include "./../lang/Object.h"
19
20/* ***************************************************************************************
21 * Namespace
22 */
23namespace ufm::func {
24 class SupplierEvent;
25} // namespace ufm::func
26
27/* ***************************************************************************************
28 * Class/Interface/Struct/Enum
29 */
30
38class ufm::func::SupplierEvent final : public Object, public ufm::func::Supplier<> {
39 /* *************************************************************************************
40 * Variable
41 */
42 private:
43 Interface& (*vFunction)(void);
44
45 /* *************************************************************************************
46 * Abstract Method
47 */
48
49 /* *************************************************************************************
50 * Construct Method
51 */
52 public:
63 template <typename R>
64 SupplierEvent(R& (*function)(void)) {
65 this->vFunction = reinterpret_cast<Interface& (*)(void)>(function);
66 return;
67 }
68
75 virtual ~SupplierEvent(void) override;
76
77 /* *************************************************************************************
78 * Operator Method
79 */
80 public:
90 template <typename R>
91 inline operator const Supplier<R>&(void) const {
92 const Supplier<R>* src = this;
93 return *reinterpret_cast<const Supplier<R>*>(this);
94 }
95
105 template <typename R>
106 inline operator Supplier<R>&(void) {
107 Supplier<R>* src = this;
108 return *reinterpret_cast<Supplier<R>*>(this);
109 }
110
111 /* *************************************************************************************
112 * Override Method - ufm::func::Supplier<>
113 */
114 public:
115 virtual Interface& get(void) override;
116
117 /* *************************************************************************************
118 * Public Method
119 */
120
121 /* *************************************************************************************
122 * Protected Method
123 */
124
125 /* *************************************************************************************
126 * Private Method
127 */
128
129 /* *************************************************************************************
130 * Static Variable
131 */
132
133 /* *************************************************************************************
134 * Static Method
135 */
136};
137
138/* ***************************************************************************************
139 * End of file
140 */
141
142#endif /* MFRAME_7F766F57_BAD7_450F_A3E1_A0A364C87CDE */
供應事件類別
Definition SupplierEvent.h:38
SupplierEvent(R &(*function)(void))
使用函數指針建構供應事件
Definition SupplierEvent.h:64
virtual Interface & get(void) override
獲取資源實例
virtual ~SupplierEvent(void) override
解構供應事件物件
物件基底類別
Definition Object.h:63
Definition BiConsumer.h:22
[Interface] 供應者函數式介面模板
Definition Supplier.h:42
類別共用基礎介面
Definition Interface.h:152