mFrame
載入中...
搜尋中...
無符合項目
Object.h
1
8#ifndef MFRAME_E0630DAA_6AA0_44AB_8E3D_C89ABCA310DE
9#define MFRAME_E0630DAA_6AA0_44AB_8E3D_C89ABCA310DE
10
11/* ***************************************************************************************
12 * Include
13 */
14
15//----------------------------------------------------------------------------------------
16
17//----------------------------------------------------------------------------------------
18#include "./../lang/Interface.h"
19#include "./../sys/ErrorCode.h"
20
21/* ***************************************************************************************
22 * Namespace
23 */
24namespace ufm::lang {
25 class Object;
26 extern void system_error(const char* message,
27 const char* path,
29} // namespace ufm::lang
30
31namespace ufm::sys {
32 class Thread;
33} // namespace ufm::sys
34
35/* ***************************************************************************************
36 * Macro
37 */
38#ifdef UFM_DEBUG
39#define UFM_THROW(message, code) \
40 ufm::lang::system_error(message, __PRETTY_FUNCTION__, code)
41#else
42#define UFM_THROW(message, code) ufm::lang::system_error("", "", code)
43#endif
44
45/* ***************************************************************************************
46 * Class/struct/Struct
47 */
48
64 /* *************************************************************************************
65 * Variable
66 */
67
68 /* *************************************************************************************
69 * Abstract Method
70 */
71
72 /* *************************************************************************************
73 * Construct Method
74 */
75
76 /* *************************************************************************************
77 * Operator Method
78 */
79 public:
85 void* operator new(size_t n);
86
93 void* operator new(size_t n, void* p);
94
95 /* *************************************************************************************
96 * Override - ufm::lang::Interface
97 */
98 public:
104 virtual ufm::lang::Object& getObject(void) override;
105
106 /* *************************************************************************************
107 * Public Method
108 */
109 public:
114 void delay(int milliseconds) const;
115
121 bool equals(Object* object) const;
122
128 bool equals(Object& object) const;
129
133 inline void wait(void) const {
134 this->wait(0);
135 }
136
142 bool wait(int timeout) const;
143
148 bool yield(void) const;
149
154 int lock(void) const;
155
160 int unlock(void) const;
161
167
173 virtual int hashcode(void) const;
174
175 /* *************************************************************************************
176 * Public Method
177 */
178
179 /* *************************************************************************************
180 * Protected Method
181 */
182
183 /* *************************************************************************************
184 * Private Method
185 */
186
187 /* *************************************************************************************
188 * Private Method
189 */
190
191 /* *************************************************************************************
192 * Static Variable
193 */
194};
195
197/* ***************************************************************************************
198 * End of file
199 */
200
201#endif /* MFRAME_E0630DAA_6AA0_44AB_8E3D_C89ABCA310DE */
物件基底類別
Definition Object.h:63
ufm::sys::Thread * currentThread(void) const
取得當前執行緒指標
int unlock(void) const
核心解鎖
void delay(int milliseconds) const
延遲指定的毫秒數進行執行緒等待
virtual int hashcode(void) const
返回對象的哈希碼值。支持這種方法是為了散列表,如HashMap提供的那樣。
void wait(void) const
使當前線程等待直到被通知
Definition Object.h:133
int lock(void) const
核心鎖定,鎖定期間禁止線程切換
bool equals(Object &object) const
判斷與另一物件是否為相同參照(參照型態比較)
bool wait(int timeout) const
等待通知或超時
bool equals(Object *object) const
判斷與另一物件是否為相同參照(指標型態比較)
virtual ufm::lang::Object & getObject(void) override
取得對應的 Object 物件
bool yield(void) const
讓執行緒讓渡控制權給同優先權的下一個執行緒
執行緒類別
Definition Thread.h:49
Definition Appendable.h:23
void system_error(const char *message, const char *path, ufm::sys::ErrorCode code)
處理系統錯誤並輸出錯誤資訊
系統功能相關的命名空間
Definition Object.h:31
ErrorCode
系統錯誤碼列舉
Definition ErrorCode.h:35
類別共用基礎介面
Definition Interface.h:152